

def natural_sort(ar):
    "\n    >>> natural_sort('1 3 4 2 5'.split())\n    ['1', '2', '3', '4', '5']\n    >>> natural_sort('1 10 20 2 3 4'.split())\n    ['1', '2', '3', '4', '10', '20']\n    "
    to_sort = []
    for item in ar:
        spl = re.split('(\\d+)', item)
        l2 = []
        for el in spl:
            try:
                n = int(el)
            except:
                n = el
            l2.append(n)
        to_sort.append((l2, item))
    to_sort.sort()
    return [x[1] for x in to_sort]

dataset/ETHPy150Open ngsutils/ngsutils/ngsutils/support/ngs_utils.py natural_sort/original