dict_d = {'Blue': [('Camaro', 10, 12)], 'Red': [('Camara', 10, 5)], 'Green': [('Nancy', 10, 8), ('Steve', 7, 8), ('Rich', 10, 4)]}
I have a dictionary above, and I only want to sort the one with multiple values, which is "Green" in this case. I want to sort it by name. Basically, what I want to get is:
{'Blue': [('Camaro', 10, 12)], 'Red': [('Camara', 10, 5)], 'Green': [('Nancy', 10, 8), ('Rich', 10, 4), ('Steve', 7, 8)]}
The difference is the that the tuples in Green has been sorted by name.
Here is what I have tried:
sorted((dict_d).items(), key = (lambda x: list(x)[1][0]))
It did not give me any error and it did not sort..... So confused...