[Tutor] sorting dictionary keys?

Kent Johnson kent37 at tds.net
Tue May 13 14:25:12 CEST 2008


On Tue, May 13, 2008 at 7:32 AM, Mugund K <k.mugund at yahoo.com> wrote:
>
> A quick but ugly [brain-dead :-) ]fix would be sorting keys seperately,

> >>> temp = d.keys()
> >>> temp.sort()
> >>> for i in temp:

Not so ugly; before sorted() was introduced (Python 2.4) that would be
the way to do it.

Kent


More information about the Tutor mailing list