I have List of Lists which I needed to sort by first Index. I found python script and implemented it as you can see in the attachment:
It worked perfectly, however, because of the nature of my list, I need NATURAL SORT, rather then SORT.
I did some research on the forum and found Orchid’s node “List.SortNatural”. Furthermore, I found Kukul’s script for Python, that seem to do the same trick as “List.SortNatural” node.
Now, since I have little coding knowledge, does anyone know how to merge this two codes to create “Natural Sort List of Lists by first Index”?
Also, any other way is just fine to me.
I am copy-pasting Kukul’s code for easy reference:
#input assigned the IN variable
data = IN #list
boolean = IN #Boolean to reverse
convert = lambda text: int(text) if text.isdigit() else text.lower()
alphanum = lambda key: [convert(t) for t in re.split(’([0-9]+)’, key)]
return sorted(var, key = alphanum, reverse = boolean)
OUT = natural_sort(data)
Thank you and have a nice day!