Sort a list of tuples depending on two elements [duplicate]

sorted(unsorted, key=lambda element: (element[1], element[2]))

I’ve assumed an order for the keys from the sample output.

Leave a Comment