Reputation: 190
I have an environment variable called %CCDeviceID%. When I run a command using python in Command Prompt, I want to be able to use this variable, and including %CCDeviceID% in the script doesn't work. How can I implement environment variables into my python script?
Thanks Ed
Upvotes: 4
Views: 184
Reputation: 59571
You can get a listing of all environment variables available to you simply by doing the following:
>>> import os
>>> print os.environ
os.environ
is a dictionary mapping env variable name to its value
In your case, you probably need to omit the %
symbols. To get CCDeviceID
.
Upvotes: 3