keys in dictionary
Georges Barthelemy
barthelemy.georges at neuf.fr
Tue Nov 22 12:09:48 EST 2005
use (1,2) , (3,4)....
"Shi Mu" <samrobertsmith at gmail.com> a écrit dans le message de news:
mailman.987.1132638229.18701.python-list at python.org...
I run the following code and got wrong message, but I still want to
make [1,2],[4,3] and [6,9]
to be keys of the dictionary or change the style a little bit. How to do
that?
Thanks!
>>> p=[[1,2],[4,3],[6,9]]
>>> n=dict([(x,[]) for x in p])
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
TypeError: list objects are unhashable
>>>
More information about the Python-list
mailing list