list1 = { 'aa':4, 'ab':3, 'wr':7, 'de':6 } print({k: v for k, v in sorted(list1.items(), key=lambda item: item[1],reverse=True)})
I've used the list comprehension to sort by the values of the dictionary
1.4m articles
1.4m replys
5 comments
57.0k users