Re: keys in dictionary

2005-11-22 Thread Georges Barthelemy
use (1,2) , (3,4) "Shi Mu" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] 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,

Re: keys in dictionary

2005-11-21 Thread Martin v. Löwis
Shi Mu wrote: > 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? Make them tuples: >>> p=[[1,2],[4,3],[6,9]] >>> n=dict([(tuple(x),[]) for x in p]) >>> n {(6, 9): [