dict invert - learning question

mrkafk at gmail.com mrkafk at gmail.com
Sat May 3 19:29:44 EDT 2008


On 4 Maj, 01:27, mrk... at gmail.com wrote:

> >>> a={1:'a', 2:'b', 3:'c'}

Oops, it should obviously be:

>>> dict(zip(a.values(), a.keys()))
{'a': 1, 'c': 3, 'b': 2}




More information about the Python-list mailing list