[Tutor] set key to sort
sander.sweers at gmail.com
Sat Jan 31 11:23:56 CET 2009
On Sat, Jan 31, 2009 at 10:51, prasad rao <prasadaraon50 at gmail.com> wrote:
> I got a problem sorting a list of lists.
> [[112, 'p'], [114, 'r'], [97, 'a'], [115, 's'], [97, 'a'], [100, 'd'], [97,
> 'a'], [114, 'r'], [97, 'a'], [111, 'o']]
> How can I formulate a key to sort based on the first element of each list.
> sorting list of lists might have been discussed in the resent past.
By default sort() will use the first value to sort so no key would be needed.
More information about the Tutor