sorting a tuple
quinn at upchuck.ugcs.caltech.edu
Wed Nov 15 03:47:34 CET 2000
On Wed, 15 Nov 2000 01:13:21 GMT, etsang at my-deja.com <etsang at my-deja.com> wrote:
>I forgot to mention that the tuple is only containg integers. E.g.
>items = ('1','2','3','4','5','6')
>And I want to sort it in decending order with a built in library
>funciton if possible to make code clean
There are no integers in that tuple :) But, to sort it:
y = list(x)
Answers to possible questions you may have:
Q: "Why must I copy the tuple to a list?"
A: Tuples cannot be modified. That's the whole point.
Q: Isn't there a nicer way to reverse sort?
A: No. See the FAQ (this way *is* nice).
More information about the Python-list