data = [("Apples", 5, "20"), ("Pears", 1, "5"), ("Oranges", 6, "10")]
data.sort(key=lambda x:x[0])
print(data)
OUTPUT
[('Apples', 5, '20'), ('Oranges', 6, '10'), ('Pears', 1, '5')]
from kite.com
^^
a = sorted(a, key=lambda x: x.modified, reverse=True)
data = [("Apples", 5, "20"), ("Pears", 1, "5"), ("Oranges", 6, "10")]
data.sort(key=lambda x:x[0])
print(data)
OUTPUT
[('Apples', 5, '20'), ('Oranges', 6, '10'), ('Pears', 1, '5')]