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?