import operator
tup=(("a",2),("b",2),("a",1))
sorted(tup, key=operator.itemgetter(1, 0))
sorted(tup, key=operator.itemgetter(1, 0), reverse=True)
tup=(("a",2),("b",2),("a",1))
sorted(tup, key=operator.itemgetter(1, 0))
sorted(tup, key=operator.itemgetter(1, 0), reverse=True)
No comments:
Post a Comment