Say I have the following list:
mylist=[((0, 2), 4),
((0, 3), 9),
((0, 7), 49),
((0, 17), 50),
((0, 67), 85),
((0, 77), 98),
((1, 2), 1),
((1, 3), 4),
((1, 4), 9)]
How can I sort it based on the integer, stand-alone value within each tuple? Said values are, in the example, 4
, 9
, 49
, and so forth.
The result should be something like this:
mylist=[((1, 2), 1)
((0, 2), 4),
((1, 3), 4),
((0, 3), 9),
((1, 4), 9)
((0, 7), 49),
((0, 17), 50),
((0, 67), 85),
((0, 77), 98)]
The order in which the (x,y)
values in each tuple are sorted is irrelevant.