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
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
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
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