Python @ DjangoSpin

Python: Fetching Environment Variables using the os module

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon
Reading Time: 1 minutes

Fetching Environment Variables in Python using the os module

Fetching Environment Variables in Python using the os module

The environment variables of your system can be read using the os module's environ attribute.

>>> import os
>>> os.environ
# an environ object, a dictionary-like object whose elements can be accessed using keys.
>>> os.environ['PATH']
# value of PATH environment variable

See also:

Buffer this pageShare on FacebookPrint this pageTweet about this on TwitterShare on Google+Share on LinkedInShare on StumbleUpon

Leave a Reply