[python] Sorting dictionary keys in python

I have a dict where each key references an int value. What's the best way to sort the keys into a list depending on the values?

This question is related to python sorting

The answer is


my_list = sorted(dict.items(), key=lambda x: x[1])

[v[0] for v in sorted(foo.items(), key=lambda(k,v): (v,k))]

I like this one:

sorted(d, key=d.get)