yes. i understand now.
but i use another trick.
list is in vary size, so i do not wanna copy it.
Jim [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
MaHahaXixi wrote:
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
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,
yes. i think it does so.
it take me the whole afternoon to find out the bug (mine)
i change:
for i in range(len(j) -1, -1, -1):
d = j[i]
if d = 10:
j.remove(d)
the real code is not so simple,so j[11:] will not work for me.
but, i think phthon could found that i remove the current
SORRY, my inattention
Fredrik Lundh [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
MaHahaXixi [EMAIL PROTECTED] wrote:
for python, i am a newbie, but i did not found the warning of such usage
from the python tutorial
4.2 for Statements
It is not safe to modify