Sorting a dictionary by value
Roy Culley
rgc at swissonline.ch
Thu Jul 4 22:09:31 EDT 2002
More information about the Python-list mailing list
Thu Jul 4 22:09:31 EDT 2002
- Previous message (by thread): Sorting a dictionary by value
- Next message (by thread): Sorting a dictionary by value
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I'm sorry if this is a novice question but I have searched google
and the python FAQ and haven't found an answer.
I have a large dictionary where I want to sort and print based
on the largest values in a dictionary and not the keys.
Now in perl you can do:
@Keys = sort { $Hash{$b} <=> $Hash{$a} } keys %Hash;
Is there any such magic for python?
- Previous message (by thread): Sorting a dictionary by value
- Next message (by thread): Sorting a dictionary by value
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list