Skip navigation.

Archives

Python - Sort A Dictionary By Values

Python dictionaries are unordered, but you can extract the keys and values and sort them yourself in a list.

lets say you have this dictionary:
{'a': 2, 
 'b': 4, 
 'c': 3,
 'd': 1}
.. and you want to convert it into a list, sorted by value (not key), like this:

Check out WeeWar.com

A few people have found out about WeeWar.com from my blog. I can tell since I see how many people have joined from my referral link.**

image

Back Bay Lightning Strike

The Building across the street from me (Back Bay, Boston, MA) just got struck by lightning during a thunderstorm: » login or register to post comments | feed | read more