一般情况下这种情况出现在字典中,如下:
a_dict = {'name':'levin','job':'teacher'}
for k,v in a_dict:
... print k,v
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: too many values to unpack
正确写法:
a_dict = {'name':'levin', 'job' : 'teacher'}
for k,v in a_dict.items():
print k,v