[Tutor] advanced sorting

chinni srikanth007m at gmail.com
Wed Sep 5 06:12:37 CEST 2007


Hi,
i am using a macpro version(10.4.11) and python version is "2.3.5"
Message: 10
Date: Wed, 05 Sep 2007 01:00:44 +0530
From: Noufal Ibrahim <noufal at airtelbroadband.in>
Subject: Re: [Tutor] advanced sorting
To: srikanthkumar007m at rediffmail.com
Cc: tutor at python.org
Message-ID: <46DDB264.7010006 at airtelbroadband.in>
Content-Type: text/plain;       charset=ISO-8859-1;     format=flowed

chinni wrote:
>
>
> In Advance Sorting by giving the keywords to sort the list.But, iam
> getting the fallowing errors
>
>  >>> x = ['srikanth', 'kumar', 'muppandam', 'will', 'be', 'a']
>  >>> x.sort(key=len)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: sort() takes no keyword arguments
>  >>> x.sort(reverse=True)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> TypeError: sort() takes no keyword arguments
>
>

Seems to work fine for me. What version of Python are you using?

 >>> x=['srikanth', 'kumar', 'muppandam', 'will', 'be', 'a']
 >>> x.sort(reverse=True)
 >>> x
['will', 'srikanth', 'muppandam', 'kumar', 'be', 'a']
 >>>

--
~noufal


-- 
Best Regards,
M.Srikanth Kumar,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070904/02125a2a/attachment.htm 


More information about the Tutor mailing list