我正在使用Trello API,並且在Stackoverflow上對其他人有一個常見問題。我嘗試使用提供的解決方案,但得到一個奇怪的錯誤。無法弄清楚原因。Python,JSON TypeError
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: list indices must be integers, not str
這是看似常識的賠率。順便提一句,我輸入了一些整數,並沒有任何效果! (我確實保存了!)
非常感謝,提前。
'j'是一個'list'而不是'dict'。 –