Sorting a dictionary
Ronn Ross
ronn.ross at gmail.com
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
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090512/32213ea3/attachment.html>
More information about the Python-list
mailing list