Want more features on Pastebin? Sign Up, it's FREE!
Guest

snipplet

By: a guest on May 14th, 2012  |  syntax: Python  |  size: 0.23 KB  |  views: 28  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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]
clone this paste RAW Paste Data