for loop

Binu K S binux.lists at gmail.com
Sun Dec 12 23:56:51 EST 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