RosettaCodeData/Task/Sort-an-array-of-composite-structures/Python/sort-an-array-of-composite-structures-3.py
2023-07-01 13:44:08 -04:00

3 lines
113 B
Python

from operator import itemgetter
people = [(120, 'joe'), (31, 'foo'), (51, 'bar')]
people.sort(key=itemgetter(1))