JuHui wrote:
> >>> a='String'
> >>> for x in a:
> ... print x
> ...
> S
> t
> r
> i
> n
> g
> >>>
>
> can I get the index number of a in the upon loop within for x in a
> loop?
Although enumerate is the 'right' answer, I personally prefer :
i = 0
while i < len(some_sequence):
val = some_sequence[i]
...
i += 1
This is so that I can manually wind 'i' backwards and forwards manually
from other parts of the code.
Fuzzyman
http://www.voidspace.org.uk/python/index.shtml
--
http://mail.python.org/mailman/listinfo/python-list