Is the Python for statement the same as for each in other languages?

Diez B. Roggisch deets at nospam.web.de
Tue Apr 8 19:55:06 CEST 2008


jmDesktop schrieb:
> Thank you.  It looks like it is, but I wanted to make sure I
> understood.  Also, I didn't see a "regular" for loop construct either
> (i=0;i<=10;i++), etc.  I'm still new at it, but is there one of those?

Yes, it's foreach. And for your usecase, use

for i in xrange(11):
     ...


Diez



More information about the Python-list mailing list