I have a list of items with alphanumeric values (interface names). The way Python orders such a list is not what I in my case need.
>>> l = ["ether1", "ether2", "ether11", "ether22", "bond1", "bond2", "bond100", "bond101", "bond1000"]
>>> ls = sorted(l)
>>> ls
['bond1', 'bond100', 'bond1000', 'bond101', 'bond2', 'ether1', 'ether11', 'ether2', 'ether22']
The sorting that I need is the following:
['bond1', 'bond2', 'bond100', 'bond101', 'bond1000', 'ether1', 'ether2', 'ether11', 'ether22']
Unfortunately I couldn't find a solution in existing questions or in the Python wiki for sorting: https://wiki.python.org/moin/HowTo/Sorting/
How can I achieve such sorting?