Here's my function:
def printSubnetCountList(countList):
print type(countList)
for k, v in countList:
if value:
print "Subnet %d: %d" % key, value
Here's the output when the function is called with the dictionary passed to it:
<type 'dict'>
Traceback (most recent call last):
File "compareScans.py", line 81, in <module>
printSubnetCountList(subnetCountOld)
File "compareScans.py", line 70, in printSubnetCountList
for k, v in countList:
TypeError: 'int' object is not iterable
Any ideas?
question from:
https://stackoverflow.com/questions/5750664/python-iterating-through-a-dictionary-gives-me-int-object-not-iterable 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…