这是我的代码
if __name__ == "__main__":
clearLogConfig = os.getenv("CLEAR_LOG_CONFIG")
print clearLogConfig
clearLogConfig = json.loads(clearLogConfig)
print clearLogConfig
exit()
手动测试也是ok的
这是我的代码
if __name__ == "__main__":
clearLogConfig = os.getenv("CLEAR_LOG_CONFIG")
print clearLogConfig
clearLogConfig = json.loads(clearLogConfig)
print clearLogConfig
exit()
手动测试也是ok的
看了下你的代码,应该是clearLogConfig
变量的值不是标准的json字符串导致的,可以试下一下代码:
if __name__ == "__main__":
clearLogConfig = os.getenv("CLEAR_LOG_CONFIG")
clearLogConfig = clearLogConfig[1:-1]
print clearLogConfig
clearLogConfig = json.loads(clearLogConfig)
print clearLogConfig
exit()
4 回答4.4k 阅读✓ 已解决
4 回答3.8k 阅读✓ 已解决
1 回答3k 阅读✓ 已解决
3 回答2.1k 阅读✓ 已解决
1 回答4.5k 阅读✓ 已解决
1 回答3.8k 阅读✓ 已解决
1 回答2.8k 阅读✓ 已解决
你得贴一下
clearLogConfig
这个是啥?是一个满足JSON格式的字符串么?多了单引号导致的, 如下代码会报错: