Sorting a Dictionary

rbl at hal.cwru.edu rbl at hal.cwru.edu
Tue Mar 14 10:11:36 EST 2000


Many thanks to those who replied.  I tried the shortest, simplest
choice:

l = map (None, mydict.values (), mydict.keys ())
l.sort ()
l.reverse ()

then added the following to get one count, word1, word2 tuple on each line:

for i in range(len(l)):
		print l[i]

Works like a charm!

VERY helpful newgroup, it is!

Cheers,
Rob Lake
rbl at hal.cwru.edu




More information about the Python-list mailing list