programming-examples/python/_Basics/Access environment variables.py
2019-11-15 12:59:38 +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('*----------------------------------*')