【发布时间】:2016-07-03 00:54:14
【问题描述】:
所以我尝试使用配置文件中的字典将报告名称存储到 API 调用。所以是这样的:
report = {'/report1': '/https://apicall...', '/report2': '/https://apicall...'}
我需要存储多个报告:apicalls 到一个配置值。我正在使用 ConfigObj。我在那里读过documentation,documentation,它说我应该能够做到。我的代码如下所示:
from configobj import ConfigObj
config = ConfigObj('settings.ini', unrepr=True)
for x in config['report']:
# do something...
print x
但是,当它遇到 config= 时,它会引发引发错误。我有点迷失在这里。我什至复制并粘贴了他们的示例和相同的内容,“引发错误”。我正在使用 python27 并安装了 configobj 库。
【问题讨论】:
-
抛出了哪个错误?您可以在此处粘贴完整的堆栈跟踪吗?
标签: python python-2.7 dictionary config configobj