by RyanMcGreal · 16y ago · 0 comments
Now that's a feature I wish I knew about sooner. I've been using:
for item in a:
print a.index(item), item
which has always felt kludgy. import itertools
for (index, item) in zip(itertools.count(0), "hallo"):
print index, item
Itertools is worth checking out for other goodies, too. for i in range(len(a)):
print i, a[i]