I have the following dictionary:
{1: (8, 3), 0: (8, 0), 2: (2, 3), 3: (2, 0)}
I would like to sort it by the tuple key and then by the key of the dictionary so the above will be:
[{1: (2, 3), 3: (2, 0),0: (8, 3), 1: (8, 0)}]
I wrote the following:
result_list = sorted(codebook.items(), key= lambda item: item[1][0])
This sort by the tuple key but not afterwards by the dictionary key.
How can I do it?