This one I think I know... Try with: for k in sorted(word_count) : print k,"=",word_count[k]
You need to do the sorting before iterating over the keys... Jaime On Tue, May 12, 2009 at 1:54 PM, Ronn Ross <ronn.r...@gmail.com> wrote: > 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 > > -- > http://mail.python.org/mailman/listinfo/python-list > > -- (\__/) ( O.o) ( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes de dominación mundial. -- http://mail.python.org/mailman/listinfo/python-list