Reputation: 93
I have a=[[1,2],[2,1],[3,2],[5,1],[4,1]]
I want to get the result sorted list as
[[2,1],[4,1],[5,1],[1,2],[3,2]]
Upvotes: 1
Views: 149
Reputation: 93
I got this by doing following-
a.sort(key=lambda tup:tup[0])
a.sort(key=lambda tup:tup[1])
Upvotes: 2