📜  repl 中的 .env 文件 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:07.837000             🧑  作者: Mango

代码示例1
#in the ".env" file. THIS IS FOR PYTHON
TOKEN=38zdJSDF48fKJSD4824fN
DB_USERNAME="admin" # defining variables like you'd do in python but secret
DB_PASSWORD=w0ws0secure!!

#in the "main.py" file

import os
print(os.getenv("DB_USERNAME"))
# prints "admin"