Set environment variables on the fly
import os
print(os.environ.get('MYNAME'))
print(os.getenv('MYNAME'))
- On Linux and macOS:
MYNAME=Foo python examples/os/show_env.py
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
import os
print(os.environ.get('MYNAME'))
print(os.getenv('MYNAME'))
MYNAME=Foo python examples/os/show_env.py