I have list
value =[(22, 11, 195, 37), (19, 11, 184, 45), (300, 17, 12, 19), (210, 18, 128, 30) (100, 18, 128, 30)]
Now i Need to sort the list in combination of first two values in the list of ascending order.
like this
s = [(19, 11, 184, 45), (22, 11, 195, 37), (300, 17, 12, 19),(100, 18, 128, 30), (210, 18, 128, 30) ]
I used
s = sorted(value, key = lambda x: (x[1], x[0]))
And i ended up sorting the list for 2nd (x[1]) value of the list like this,
s = [(22, 11, 195, 37), (19, 11, 184, 45), (300, 17, 12, 19), (210, 18, 128, 30) (100, 18, 128, 30)]
Are there any methods? I have also tried with operator library, it gives me the same result.