2016-11-17 20 views
1

私はPythonで辞書を作成しました。TypeError: 'long'オブジェクトは反復不可能です

stb_info = self.stb_type() 
print type(stb_info) #The output gives me dict 

私は、次のエラーを取得しています各グループ

for group_no, shelves in stb_info: 
    self.thread_function(group_no, shelves) 

のための私のトレッド機能を実行したい:

TypeError: 'long' object is not iterable 

だから、どのように私はこのバグを解決することができますか?

答えて

5

お試しstb_info.items() dictを繰り返し実行するだけで、キーを繰り返し処理するので、キー(長いもの)を2つの部分に解凍しようとしていますが、これは不可能です。

+1

それはPython 2.xであるため、 '.iteritems()'です。 – katrielalex

関連する問題