Re: [Tutor] set key to sort

2009-01-31 Thread Kent Johnson
On Sat, Jan 31, 2009 at 4:51 AM, prasad rao wrote: > hell > I got a problem sorting a list of lists. > ml= > [[112, 'p'], [114, 'r'], [97, 'a'], [115, 's'], [97, 'a'], [100, 'd'], [97, > 'a'], [114, 'r'], [97, 'a'], [111, 'o']] > sorted(ml,key=?) > How can I formulate a key to sort based on the fi

Re: [Tutor] set key to sort

2009-01-31 Thread Sander Sweers
On Sat, Jan 31, 2009 at 10:51, prasad rao wrote: > I got a problem sorting a list of lists. > ml= > [[112, 'p'], [114, 'r'], [97, 'a'], [115, 's'], [97, 'a'], [100, 'd'], [97, > 'a'], [114, 'r'], [97, 'a'], [111, 'o']] > sorted(ml,key=?) > How can I formulate a key to sort based on the first eleme

[Tutor] set key to sort

2009-01-31 Thread prasad rao
hellI got a problem sorting a list of lists. ml= [[112, 'p'], [114, 'r'], [97, 'a'], [115, 's'], [97, 'a'], [100, 'd'], [97, 'a'], [114, 'r'], [97, 'a'], [111, 'o']] sorted(ml,key=?) How can I formulate a key to sort based on the first element of each list. sorting list of lists might have been d