本文共 437 字,大约阅读时间需要 1 分钟。
python 获取环境变量
In , how to get an environment variable?
在 ,如何获取环境变量?
In Python, you may use this piece of code to get an environment variable:
在Python中,您可以使用以下代码来获取环境变量:
os.environ.get('ENV_MIGHT_EXIST')
or this piece of code:
或这段代码:
os.getenv('ENV_MIGHT_EXIST')
It will return None
if the environment variable is not present.
如果环境变量不存在,它将返回None
。
and for more ways, please check .
以及更多方法,请检查 。
翻译自:
python 获取环境变量
转载地址:http://pzlwd.baihongyu.com/