Sorting dictionary keys in python [duplicate]
Solution 1:
I like this one:
sorted(d, key=d.get)
Solution 2:
>>> mydict = {'a':1,'b':3,'c':2}
>>> sorted(mydict, key=lambda key: mydict[key])
['a', 'c', 'b']
Solution 3:
my_list = sorted(dict.items(), key=lambda x: x[1])