[2.5.1.1/dictionary] Change sorting order?

Gilles Ganault nospam at nospam.com
Fri Jan 22 08:07:04 EST 2010


On Fri, 22 Jan 2010 13:17:44 +0100, Gilles Ganault <nospam at nospam.com>
wrote:
>I see that dictionaries can be sorted using the... sort() method, but
>is it possible to have Python start sorting from a different letter?

Looks like the solution is to read the list of keys into a list, sort
the list, and then use this to read the dictionary:

http://code.activestate.com/recipes/52306/

But I haven't found whether a list can be sorted by starting from a
given letter instead of "a".



More information about the Python-list mailing list