#Any way to do a custom sort with Python?

9 messages · Page 1 of 1 (latest)

silver oyster
#

so u wanna reverse sort it every 3rd letter?

#

u can sort in reverse

#

but you will have to write some logic to have it in the pattern u described

#

sort(reverse=True) for reverse sort

#

iirc

hollow fox
#

No, that was just an example. Suppose I had this order: "whq123", and all items in my list were made up of different combinations of those 6 characters. Is there a way to sort the list so that items beginning with a w come first, then h, then q, 1, 2 and 3?

silver oyster
#

so u have bunch of those orders?

#

or just one?

hollow fox
#

Basically, I want to be able to choose one item from the list, and have every other item get sorted by the item I chose.