getting an index in a for loop
sibunks at hotmail.com
Fri Jan 31 14:43:22 CET 2003
I am iterating over a string and getting back each letter no problem.
>>> mystring = "abcdefg"
>>> for char in mystring:
... print char
which is fine, but is there any way of finding out the index into the
are referencing? Or do I have to set up a temporary counter and
increment it in the loop each time?
I just have a feeling that Python should be cleverer than that - is
More information about the Python-list