How to use list as key of dictionary?

Boris Borcic bborcic at gmail.com
Tue Nov 6 02:05:08 EST 2007


Davy wrote:
> Hi all,
> 
> We know that list cannot be used as key of dictionary.

Yeah, but do we know why ?

> So, how to work
> around it?

That's a subsidiary question.

> 
> For example, there is random list like l=[1,323,54,67].

Don't use 1owercase L as a variab1e name, p1ease !

> 
> Any suggestions are welcome!

>>> {tuple([1,323,54,67]):666}
{(1, 323, 54, 67): 666}



More information about the Python-list mailing list