programming-examples/python/_Basics/Access environment variables.py

10 lines
372 B
Python
Raw Normal View History

2019-11-15 12:59:38 +01:00
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('*----------------------------------*')