13 May 14:25
Re: sorting dictionary keys?
From: Kent Johnson <kent37 <at> tds.net>
Subject: Re: sorting dictionary keys?
Newsgroups: gmane.comp.python.tutor
Date: 2008-05-13 12:25:12 GMT
Subject: Re: sorting dictionary keys?
Newsgroups: gmane.comp.python.tutor
Date: 2008-05-13 12:25:12 GMT
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 _______________________________________________ Tutor maillist - Tutor <at> python.org http://mail.python.org/mailman/listinfo/tutor
]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
_______________________________________________
Tutor maillist - Tutor <at> python.org
RSS Feed