<p>我得到以下错误:Stats PlayerList=competitionList[j]KeyError:2
我在competitionList中保存了许多列表,这是一本字典。我想遍历字典中列表中的所有对象。你知道吗</p>
<pre><code>def Stats(competitionList, playerList):
no_of_competitions = int(len(competitionList))
x = (len(playerList))
for i in range(no_of_competitions):
for j in range (int(x)):
#My error occurs here
PlayerList=competitionList[j]
for player in PlayerList:
print("player: ", player.name)
print ("list :", player.name, player.victories)
</code></pre>