Skip to content
Advertisement

How to sort a python list of arbitrary strings like Excel Column Names?

E.g. I have:

JavaScript

then I need to get:

JavaScript

Advertisement

Answer

If the column identifier is guaranteed to be the second whitespace delimited token in each string then:

JavaScript

The conv() function takes the column identifiers and converts them into a value that can be used for natural sorting

Output:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement