Sorting a dictionary

Ronn Ross ronn.ross at
Tue May 12 07:54:35 EDT 2009

I'm attempting to sort for the results of a dictionary. I would like to
short by the 'key' in ascending order. I have already made several attempts
using: sorted() and .sort().
Here is my loop:
    for key,value in word_count.items():
        print sorted(key), "=", value

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list