Sorting a dictionary

rbl at hal.cwru.edu rbl at hal.cwru.edu
Mon Mar 13 15:49:38 EST 2000


I have thousands of entries in a Python dictionary:

mydict

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?

Thanks,
Rob Lake
rbl at hal.cwru.edu




More information about the Python-list mailing list