loop iterators?
Marc 'BlackJack' Rintsch
bj_666 at gmx.net
Tue Oct 17 13:15:06 EDT 2006
In <1161104511.877387.217410 at h48g2000cwc.googlegroups.com>, SpreadTooThin
wrote:
> Hi I need to get a for loop to give me an element from a list and an
> index number...
> for example:
>
> i = 0
> l = ['a','b','c']
> for e in l:
> print l, i
> i = i + 1
>
> Is there a way to get rid of the i processing in this script?
for i, e in enumerate(l):
print i, e
Ciao,
Marc 'BlackJack' Rintsch
More information about the Python-list
mailing list