我刚刚用 python 创建了一个字典。
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
那么,我该如何解决这个错误呢?
请您参考如下方法:
试试 stb_info.items()。只是迭代一个 dict 迭代它的键,所以它试图将一个键(一个长)解包成两部分,这是不可能的。
