dictionary: sorting the values preserving the order
Terry Reedy
tjreedy at udel.edu
Fri Apr 1 12:50:39 EST 2005
"Rakesh" <rakesh_usenet at yahoo.com> wrote in message
news:1112337653.401206.160510 at l41g2000cwc.googlegroups.com...
> This gets a list sorted by the keys.
That is all you *can* get (with the list keys being the dict values).
> How would I get a revised dictionary sorted by its values.
You can't. A dictionary is not sorted. The print order is arbitrary and
not controllable.
Terry J. Reedy
More information about the Python-list
mailing list