RosettaCodeData/Task/Sort-an-array-of-composite-structures/Python/sort-an-array-of-composite-structures-3.py

4 lines
113 B
Python
Raw Permalink Normal View History

2013-04-11 01:07:29 -07:00
from operator import itemgetter
people = [(120, 'joe'), (31, 'foo'), (51, 'bar')]
2015-02-20 00:35:01 -05:00
people.sort(key=itemgetter(1))