I need to do in Python the same as:
for (i = 0; i < 5; i++) {cout << i;}
but I don\'t know how to use FOR in Python to get the index
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