Sorting a dictionary

rbl at rbl at
Mon Mar 13 21:49:38 CET 2000

I have thousands of entries in a Python dictionary:


where the entries are:
{'word1, word2', integer}

I'd like to sort the dictionary in decreasing order on the
integer values.

I've thought of a 2 X N list;  a pair of lists;  a pickle;
and creating an output file to be subsequently processed by
a Unix filter.

Is there a straightforward and/or accepted way to do this
from within Python?

Rob Lake
rbl at

More information about the Python-list mailing list