How to handle environment variables in Python code.
import os
Collective acquisition
os.environ
Get by specifying the environment variable name ʻos.environ [environment variable name] `
#Example
os.environ['PATH']
If set this way, it is only valid within that Python program. System environment variables do not rewrite
# os.environ[Environment variable name] =path
os.environ['NEW_KEY'] = 'test'
Recommended Posts