how to explain such codes, python's bug or mine?

ajikoe at gmail.com ajikoe at gmail.com
Wed Apr 13 06:46:04 EDT 2005


Hi

The second style can be used:
   j = range(20)
  print j
  L = [x for x in j if x > 10]
  j = L

There are another method such poping the item based on last index to 0:
 for i in range(len(j)-1,0-1,-1):
    if j[i]<=10:
      j.pop(i)
 
 print j

Pujo




More information about the Python-list mailing list