赞
踩
import os
# 获取环境变量列表,数据类型为字典
env_dict = os.environ
# 遍历环境变量字典
for key in env_dict:
print key + ' : ' + env_dict[key]
print("The ENV Var (%s):(%s)" %(key,env_dict[key]))
import os
#读取环境变量,若变量不存在则返回 默认值 'null'
client_priv_key = os.getenv('CLIENT_KEY', 'null')
print(client_priv_key)
if client_priv_key == 'null'
print('This Envrionment does not exist!')
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。