I have some data either in a list of lists or a list of tuples, like this:
data = [[1,2,3], [4,5,6], [7,8,9]] data = [(1,2,3), (4,5,6), (7,8,9)]
Without lambda:
def sec_elem(s): return s[1] sorted(data, key=sec_elem)