def convert(text):
    return int(text) if text.isdigit() else text

def natural(item):
    return map(convert, re.split('([0-9]+)', item))
how to sort alphanumerically in Unix with sort? More complex than seems