Get number of iteration

Florian Lindner Florian.Lindner at xgm.de
Thu Jan 29 11:12:21 EST 2004


Hi!
If I iterate through a list, is there a way I can get the number of the
iteration: first, second, third, ...

l = ["three", "four", "five", "six"]
for x in l
  print x
  print x.iteration()  # <- That's what I'm looking for!
  print "next"

prints that:

three
1
next
four
2
next
fixe
3
next
six
4
next

Thx,
Florian



More information about the Python-list mailing list