[Tutor] TypeError: list objects are unhashable
qsqgeekyogdty at tiscali.co.uk
qsqgeekyogdty at tiscali.co.uk
Sun Mar 15 13:27:59 CET 2009
>>> l1 = [{'url': 'ws.geonames.org', 'type': 'findNearby',
'parameters': [50.100000000000001, 10.02]}, {'url': 'ws.geonames.org',
'type': 'findNearby', 'parameters': [50.100000000000001, 10.02]},
{'url': 'ws.geonames.org', 'type': 'countryInfo', 'parameters':
[50.100000000000001, 10.02]}, {'url': 'ws.geonames.org', 'type':
'countryInfo', 'parameters': [50.100000000000001, 10.02]}]
>>> [dict(n) for n in set(tuple(n.items()) for n in l1)]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: list objects are unhashable
How do I make this return two records instead of four?
Fancy a job? - http://www.tiscali.co.uk/jobs/
__________________________________________
More information about the Tutor
mailing list