I have a dictionary like this: >>> dct ={1: 'D', 5: 'A', 2: 'B', 3: 'B', 4: 'E'}
The following code works: >>> for k in dct: print(k, dct[k]) ... 1 D 2 B 3 B 4 E 5 A and this one too: >>> for k,v in dct.items(): print(k,v) ... 1 D 2 B 3 B 4 E 5 A But...this one? >>> for k,v in dct: print(k,v) ... Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'int' object is not iterable No idea what the error message means:-( Can anyone explain it? Thanks ahead. -- https://mail.python.org/mailman/listinfo/python-list