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!
[color=blue][color=green][color=darkred]
>>> p=[[1,2],[4,3],[6,9]]
>>> n=dict([(x,[]) for x in p])[/color][/color][/color]
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
TypeError: list objects are unhashable[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
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!
[color=blue][color=green][color=darkred]
>>> p=[[1,2],[4,3],[6,9]]
>>> n=dict([(x,[]) for x in p])[/color][/color][/color]
Traceback (most recent call last):
File "<interacti ve input>", line 1, in ?
TypeError: list objects are unhashable[color=blue][color=green][color=darkred]
>>>[/color][/color][/color]
Comment