Use natsort
library:
Install the library with the following command for Ubuntu and other Debian versions
Python 2
sudo pip install natsort
Python 3
sudo pip3 install natsort
Details of how to use this library is found here
from natsort import natsorted
files = ['run01', 'run18', 'run14', 'run13', 'run12', 'run11', 'run08']
natsorted(files)
[out]:
['run01', 'run08', 'run11', 'run12', 'run13', 'run14', 'run18']