How can I sort a list by a key described by an arbitrary function? For example, if I have:
mylist = [["quux", 1, "a"], ["bar", 0, "b"]]
I'd like to sort "mylist" by the second element of each member, e.g.
sort(mylist, key=lambda x: x[1])
how can I do this?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…