SyntaxFix
Write A Post
Hire A Developer
Questions
use enumerate:
>>> l = ['a', 'b', 'c', 'd'] >>> for index, val in enumerate(l): ... print "%d: %s" % (index, val) ... 0: a 1: b 2: c 3: d