for loop

Binu K S binux.lists at gmail.com
Mon Dec 13 05:56:51 CET 2004


If you are used to the C kind of for loops, avoid mistakes like this one:

>>> for i in range(1,6):
...     print i
...     i+=2
... 
1
2
3
4
5

Obvious if you know you are iterating over a sequence.



More information about the Python-list mailing list