I have a list of dictionaries which look like the following:
my_list = [
{'1200' : [10, 'A']},
{'1000' : [24, 'C']},
{'9564' : [6, 'D']},
]
All dictionaries in the list have one key-value pair.
I want to sort it based on the first element of each dictionaries value which is a list, so the sorted list would look like:
my_list_sorted = [
{'9564' : [6, 'D']},
{'1200' : [10, 'A']},
{'1000' : [24, 'C']},
]
As you can see the keys have different names and that's why I could not use answers from, for example, the following post: How do I sort a list of dictionaries by a value of the dictionary?