how to explain such codes, python's bug or mine?
MaHahaXixi
enjoy_linux at hotmail.com
Wed Apr 13 05:54:39 EDT 2005
>>> j = range(20)
>>> print j
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
>>> for k in j:
if k <= 10:
j.remove(k)
>>> print j
[1, 3, 5, 7, 9, 11, 12, 13, 14, 15, 16, 17, 18, 19]
>>>
Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on
win32
Type "copyright", "credits" or "license()" for more information.
i think python do convert there codes to such style:
for (i = 0; i < len(j); i++)
k = j[i]
......
what do u think?
More information about the Python-list
mailing list