John Fouhy wrote:
> On 25/10/05, Brian van den Broek <[EMAIL PROTECTED]> wrote:
>
>>To sort by the second item, try
>>
>> >>> def sort_by_second(sequence):
>>decorated = [(x[1], x) for x in sequence]
>>decorated.sort()
>>return [x[1] for x in decorated]
>
>
> With python2
John Fouhy said unto the world upon 2005-10-24 22:18:
> On 25/10/05, Brian van den Broek <[EMAIL PROTECTED]> wrote:
>
>>To sort by the second item, try
>>
>> >>> def sort_by_second(sequence):
>>decorated = [(x[1], x) for x in sequence]
>>decorated.sort()
>>return [x[1] for
On 25/10/05, Brian van den Broek <[EMAIL PROTECTED]> wrote:
> To sort by the second item, try
>
> >>> def sort_by_second(sequence):
> decorated = [(x[1], x) for x in sequence]
> decorated.sort()
> return [x[1] for x in decorated]
With python2.4, you can use the key= argume
On 25/10/05, Brian van den Broek <[EMAIL PROTECTED]> wrote:
> To sort by the second item, try
>
> >>> def sort_by_second(sequence):
> decorated = [(x[1], x) for x in sequence]
> decorated.sort()
> return [x[1] for x in decorated]
With python2.4, you can use the key= argume
Vincent Gulinao said unto the world upon 2005-10-24 09:29:
> I have a list of lists of constant width (2 rows). I need to:
> 1. delete sub-lists with None element
> 2. sort it by any sub-list index
>
> say: [ ['c','d'], ['g',None], ['a','b',], ['e','f']
> if sorted using 2nd index: [ ['a','b'], ['