getting an index in a for loop
Simon Bunker
sibunks at hotmail.com
Fri Jan 31 08:43:22 EST 2003
More information about the Python-list mailing list
Fri Jan 31 08:43:22 EST 2003
- Previous message (by thread): getting an index in a for loop
- Next message (by thread): getting an index in a for loop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I am iterating over a string and getting back each letter no problem. eg. >>> mystring = "abcdefg" >>> for char in mystring: ... print char ... a b c d e f g which is fine, but is there any way of finding out the index into the string we 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 it? Simon http://www.rendermania.com/
- Previous message (by thread): getting an index in a for loop
- Next message (by thread): getting an index in a for loop
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list