快速的问题在这里。我有这样的字典(有更多的条目):Python - 在字典里面读字典的值
champlist = {
"Aatrox": {
"id": 266,
"title": "the Darkin Blade",
"name": "Aatrox",
"key": "Aatrox"
},
"Thresh": {
"id": 412,
"title": "the Chain Warden",
"name": "Thresh",
"key": "Thresh"
}
}
而且我喜欢读所有的id。我想这样的
for champ in champlist:
print(champ['id'])
但它说:
print(champ['id']) TypeError: string indices must be integers
它不选择每一个“冠军”是一本字典,但作为一个字符串,任何与此帮助?谢谢!
我不能给予好评你,但这个工作!谢谢! – Nonitus
没有概率,很确定这已经触及每个新的Python开发者在某个点或另一个点 –