SHARE
TWEET

snipplet

a guest May 14th, 2012 28 Never
  1. >>> l = range(10)
  2. >>> for i in l:
  3. ...     if i % 2:
  4. ...             del l[i]
  5. ...
  6. Traceback (most recent call last):
  7.   File "<stdin>", line 3, in <module>
  8. IndexError: list assignment index out of range
  9. >>> l
  10. [0, 2, 3, 5, 6, 8, 9]
RAW Paste Data
Top