Re: [Tutor] Sorting on different fields

2008-12-07 Thread Lie Ryan
On Sat, 06 Dec 2008 21:47:16 -0800, the New me wrote: > is there a straightforward example? >>> import operator >>> k = [[1, 2, 3, 4], [4, 3, 2, 1], [1, 3, 2, 4], [2, 4, 3, 1]] >>> sorted(l, key=operator.itemgetter(3, 2)) [[4, 3, 2, 1], [2, 4, 3, 1], [1, 3, 2, 4], [1, 2, 3, 4]] >>> for k in sorte

Re: [Tutor] Sorting on different fields

2008-12-06 Thread the New me
writing the examples are so smart or everybody else is dum? Thanks all --- On Sat, 12/6/08, Kent Johnson <[EMAIL PROTECTED]> wrote: > From: Kent Johnson <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Sorting on different fields > To: [EMAIL PROTECTED] > Cc: tutor@pyt

Re: [Tutor] Sorting on different fields

2008-12-06 Thread Kent Johnson
On Sat, Dec 6, 2008 at 1:01 PM, the New me <[EMAIL PROTECTED]> wrote: > > > I would like to be able to sort a list of rows, > each row has (say 4) fields to sort on, > > primary key to sort on first, then the second one and so on, > > any suggestions and where to look (may be), http://personalpage

[Tutor] Sorting on different fields

2008-12-06 Thread the New me
I would like to be able to sort a list of rows, each row has (say 4) fields to sort on, primary key to sort on first, then the second one and so on, any suggestions and where to look (may be), Thanks a bunch Peter ___ Tutor maillist - Tu