Environment and os Module
Read env vars and paths.
The os Module
The os module is your gateway to the operating system: environment variables, file paths, the current directory, and process info.
import os
print('os name:', os.name)Reading Environment Variables
os.environ is a dict-like mapping of environment variables. Index it to read a value.
import os
os.environ['MY_APP_MODE'] = 'demo'
print(os.environ['MY_APP_MODE'])All lessons in this course
- Running Commands with subprocess
- Capturing Output
- Environment and os Module
- shutil for File Operations