I can use enumerate with python dictionary like so:
for count, (key, value) in enumerate(my_dict.iteritems(), 1):
print key, value, count
How do I use enumerate with the iteritems function from the six library?
The six.iteritems
equivalent of my_dict.iteritems()
is six.iteritems(my_dict)
, so:
for count, (key, value) in enumerate(six.iteritems(my_dict), 1):
print key, value, count