Sort Nested Dictionary By Values
I am trying to sort a dictionary with another dictionary inside. This is how my dict looks like: {'POS2': {'stegano': 0, 'sum': 200, 'misc': 100, 'web': 0, 'ppc': 0, 'crypto': 0, '
Solution 1:
Simply return the desired sort key from each item
sorted(inputdict.items(), key=lambda item: item[1]['sum'])
Post a Comment for "Sort Nested Dictionary By Values"