programming-examples/python/Basics/Access environment variables.py
2019-11-18 14:44:36 +01:00

10 lines
372 B
Python

import os
# Access all environment variables
print('*----------------------------------*')
print(os.environ)
print('*----------------------------------*')
# Access a particular environment variable
print(os.environ['HOME'])
print('*----------------------------------*')
print(os.environ['PATH'])
print('*----------------------------------*')