Hi, I am getting the following errorTypeError: sort() takes nokeyword arguments

G

gaurav kashyap

Hi all,
I am using python version 2.3.in a program ,
I have called the sort function.Wherein,
a.sort(reverse=True)
is giving the following error:

TypeError: sort() takes no keyword arguments.

It works in python 2.4,What can be the alternative in python 2.3

Thanks ,
Gaurav
 
P

Peter Otten

gaurav said:
Hi all,
I am using python version 2.3.in a program ,
I have called the sort function.Wherein,
a.sort(reverse=True)
is giving the following error:

TypeError: sort() takes no keyword arguments.

It works in python 2.4,What can be the alternative in python 2.3

a.reverse()
a.sort()
a.reverse()

gives the same result. If you don't care about the order of equal items

a.sort()
a.reverse()

will do.

Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,159
Latest member
SweetCalmCBDGummies
Top