I'd like to remove redundant items from a list, and have read that using
set() is an effective way to do it. But I often get the following error,
and I'd be glad for your help understanding what's wrong.

>>> z = ['test','test',1,2,1]
>>> set(z)
set(['test', 1, 2])
>>> list(set(z))        # Works as I expect
['test', 1, 2]

>>> type(n)             # This is a list of lists of strings
<type 'list'>
>>> n1 = list(set(n))
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
TypeError: list objects are unhashable
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to