RosettaCodeData/Task/Sort-an-array-of-composite-structures/Python/sort-an-array-of-composite-structures-3.py
2015-02-20 00:35:01 -05:00

3 lines
113 B
Python

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