I want to sort a list of two lists, where the elements in the two lists are pairs.
I want to sort the lists by the second element in these pairs.
For example if I have
a_list = [[51132, 55274, 58132], [190, 140, 180]]
and want
sorted_list = [[55274, 58132, 51132], [140, 180, 190]]
Is there a simpler way than the following in Python2.7?
from operator import itemgetter
sorted_list = map(list, zip(*sorted(map(list,zip(*a_list)), key=itemgetter(1))))
Best regards, Øystein
map, apart from that it looks okay to me.