index in for loops

manstey manstey at csu.edu.au
Wed May 17 07:07:41 EDT 2006


in for loops like the following:

word='abcade'

for letter in word:
   print letter


Is it possible to get the position of letter for any iteration through
the loop?

so for examlpe letter=='a', and I want to know if it is the first or
second 'a' in 'abcade'.

can i do this by looking at a property of letter?




More information about the Python-list mailing list