13 May 13:32
Re: sorting dictionary keys?
From: Mugund K <k.mugund <at> yahoo.com>
Subject: Re: sorting dictionary keys?
Newsgroups: gmane.comp.python.tutor
Date: 2008-05-13 11:32:59 GMT
Subject: Re: sorting dictionary keys?
Newsgroups: gmane.comp.python.tutor
Date: 2008-05-13 11:32:59 GMT
|
A quick but ugly [brain-dead
]fix would be sorting keys seperately,>>> for i in d.keys():
print "%s\t%s" % (i, d[i]) a 1 c 0 b 3 d 2 >>> temp = d.keys() >>> temp.sort() >>> for i in temp: print "%s\t%s" % (i, d[i]) a 1 b 3 c 0 d 2 >>> Thnx,
Mugund
--- On Tue, 5/13/08, James Hartley <jjhartley <at> gmail.com> wrote: From: James Hartley <jjhartley <at> gmail.com> |
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.
_______________________________________________ Tutor maillist - Tutor <at> python.org http://mail.python.org/mailman/listinfo/tutor
]fix would be sorting keys seperately,
RSS Feed