Consider this:
the_data = [\'a\',\'b\',\'c\']
With enumerate this loop can be written as:
for index,item in enumerate(the
Use this:
for index, (name, sport) in enumerate(the_data.iteritems()): pass
This is equivalent to:
>>> a, (b, c) = [1, (2, 3)] >>> a, b, c (1, 2, 3)
This is commonly used with zip and enumerate combo as well:
zip
enumerate
for i, (a, b) in enumerate(zip(seq1, seq2)): pass