Python - Environment variable

Management

Get

import os
print(os.environ) # all
print(os.environ['HOME']) # one with the array
print(os.environ.get("SOME_PARAMETER", "default_value")) # One with the get function

Set

import os
os.environ["ENV_NAME"] = "value"

Powered by ComboStrap