duplicate items in a list

Shi Mu samrobertsmith at gmail.com
Mon Nov 21 05:49:56 EST 2005


I used the following method to remove duplicate items in a list and
got confused by the error.

>>> a
[[1, 2], [1, 2], [2, 3]]
>>> noDups=[ u for u in a if u not in locals()['_[1]'] ]
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
TypeError: iterable argument required



More information about the Python-list mailing list