Reading Time: 1 minutes
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