blob: 7ad1e8cce713b156f1987b3149a8481a2b64c9aa [file] [log] [blame]
#!/usr/bin/env python3
#
# natural_sort.py
# Natural sort thanks to Mark Byers in StackOverflow
import re
def natural_sort(l):
convert = lambda text: int(text) if text.isdigit() else text.lower()
alphanum_key= lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
return sorted(l, key = alphanum_key)