【发布时间】:2013-07-06 05:21:08
【问题描述】:
我正在使用 Trello API,并且在 StackOverflow 上遇到了其他人的常见问题。我尝试使用提供的解决方案,但我得到一个奇怪的错误,无法弄清楚原因。
cardlist_url = "https://api.trello.com/1/boards/" + board + "$
r = requests.get(cardlist_url)
r = r.text
j = json.loads(r)
#Check for when due
print j['due']
但是在打印 j['due'] 时,我得到:
TypeError: 列表索引必须是整数,而不是 str
这似乎与常识不一致。顺便说一句,我输入了一些整数,但它没有任何效果! (我确实保存了它!)
【问题讨论】:
-
j是list不是dict。
标签: python json dictionary typeerror