py2ME/Util/Util.py
2025-01-28 00:58:23 -06:00

7 lines
277 B
Python

import re
def sort_alphanumeric(data):
""" Sorts a list alphanumerically """
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(data, key=alphanum_key))