Created
April 29, 2022 18:26
-
-
Save FerusAndBeyond/ab45709af14bd6a06d39e0b3683338ee to your computer and use it in GitHub Desktop.
env-variable part 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dotenv import load_dotenv | |
import os | |
# by default .env will be loaded | |
load_dotenv() | |
# if we had another file called .env2 | |
# we could load it using | |
# load_dotenv(".env2") | |
# now we can use os.getenv as before: | |
print(os.getenv("VARIABLE1")) | |
# => "HELLO" | |
print(os.getenv("VARIABLE2")) | |
# => "WORLD" | |
print(os.getenv("VARIABLE3")) | |
# => "HELLO WORLD" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment