Hello.
I have a nested dictionary that I want to sort.
I want the result to be like this:
I have a nested dictionary that I want to sort.
dictionary={'Hello': {'D1': 1, 'D3': 2}, 'I': {'D1': 2, 'D2': 2, 'D3': 3}, 'Am': {'D1': 2}, 'A': {'D1': 1, 'D2': 1}, 'Student': {'D1': 1}, 'This': {'D1': 1}, 'Is': {'D1': 3, 'D2': 1}, 'My': {'D1': 1}, 'Homework': {'D1': 1})}I want to sort it using the values of D1, D2, D3 in each nested dictionary.
I want the result to be like this:
sorted_dictionary={'Hello': {'D3': 2, 'D1': 1}, 'I': {'D3': 3, 'D1': 2, 'D2': 2}, 'Am': {'D1': 2}, 'A': {'D1': 1, 'D2': 1}, 'Student': {'D1': 1}, 'This': {'D1': 1}, 'Is': {'D1': 3, 'D2': 1}, 'My': {'D1': 1}, 'Homework': {'D1': 1})}