Reading the .env environment file in Python



examples/os/.env
SOME_THING=some value


examples/os/show_env.py
import os

print(os.environ.get('MYNAME'))
print(os.getenv('MYNAME'))

pip install python-dotenv


python examples/os/read_env.py
SOME_THING=other python examples/os/read_env.py