Q: how to sort a dictionary by the values ?

Bjorn Pettersen pbjorn at uswest.net
Sat Dec 30 13:37:32 EST 2000

items = [ (y,x) for x,y in mydict.items() ]

-- bjorn

hwan-jo yu wrote:

> Hi,
> If I sort the items() of dictionary, it is sorted by first the key and
> second the value.
> How can I sort it by the values ?
> Thanks in advance.

More information about the Python-list mailing list