Sort By Type Name

@janbarsoum You need something called natural sort.

Try this:

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)
    
OUT = natural_sort(IN[0])

Alternatively, you can use the Natural Sort node from Orchid package

2 Likes