[Tutor] TypeError: dict objects are unhashable

qsqgeekyogdty at tiscali.co.uk qsqgeekyogdty at tiscali.co.uk
Sat Mar 14 14:16:22 CET 2009


hi,
i have a list which contains duplicate dictionaries.

how do i extract the unique items out?

l1 = [{'a': 'ddd'}, {'a': 'ddd'}, {'b': 'eee'}, {'c': 'ggg'}]
set(l1)
TypeError: dict objects are unhashable

but, 
>>> {'a': 'ddd'} == {'a': 'ddd'}
True
>>>

david




Fancy a job? - http://www.tiscali.co.uk/jobs/
__________________________________________



More information about the Tutor mailing list