How do I sort a zipped list in Python?
sorted(zipped, key = lambda t: t[1])
import operator
sorted(zipped, key=operator.itemgetter(1))
If you want it a little bit more faster, do ig = operator.itemgetter(1)
and use ig
as key function.
Quite simple:
sorted(zipped, key=lambda x: x[1])