python sort array of dictionary by one value code example
Example 1: sort dict by value python 3
>>> d = {"aa": 3, "bb": 4, "cc": 2, "dd": 1}
>>> for k in sorted(d, key=d.get, reverse=True):
... k, d[k]
...
('bb', 4)
('aa', 3)
('cc', 2)
('dd', 1)
Example 2: sort list of dictionaries python by value
newlist = sorted(list_to_be_sorted, key=lambda k: k['name'])