Sort list by last two digits

Hi everyone,

I have a question.

How can I sort this list by the last two digits in order from the smallest to the largest?

I want create list: M.1, M.2, M.2, M.3, M.3, M.3, M.3, M.4, M.5…

Maybe in Python it will be easier to create…(but i dont know how)

Thanks in advance :slight_smile:

Hi @krzysiektoja something here could probably work, in that case…

Hmm, I dont know why i get null in “e” but in “d” it gives me list I wanted. Thanks :slight_smile:

1 Like

Maybe You know how can I sort this “element.id” list by this sorted list i get.

Dynamo solution or Python like this:

afterSplit, OUT = [], []

for i in IN[0]:
    afterSplit.append(float(i.split("M.")[1]))
    afterSplit.sort()
for i in afterSplit:
    OUT.append(("M."+str(i)).split(".0")[0])
1 Like

arhh yeah just delete the last line

1 Like

What’s the point of the list.shuffle?

Do you know how can I sort the list with element.id by what I get in sorted list of numbers. I mena I need list with this element.id but arranged in the order dedicated by the sorted list above.


“Parameter.Value” is the same list as “Element.Id”

after sorted list, You can get List Id like this:

1 Like

thanks, it works :slight_smile: