0

私はインターネットを精査しましたが、この特定のキーエラーが何を表しているのかについての言及さえ見つけることができませんでした. このコード

Player_p_dict = {}      
for player in Players:
    pp = float(Player_dict[player][0])/Team_dict[Player_dict[player][1]]
    Player_p_dict[player] = pp

print Player_p_dict

エラーメッセージを返します

  Traceback (most recent call last):   File "FantasyNHL.py", line 818,
in <module>
     pp = float(Player_dict[player][0])/Team_dict[Player_dict[player][1]]
 KeyError: 'TOT'

Player_dict はリスト エントリを含む辞書であり、Team_dict は別の辞書です (驚くべきことに、私は知っています)。

4

2 に答える 2