Sorting out strings in a list

Hello everybody,

Is there a way to sort out all strings from the following list based on the double numerical values?
In the end, each “variant” should only exist once.

image

Thanks in advance!

Hello …do you mean something like this

1 Like

Many Thanks! That’s exactly what I needed!
But how can I set the @Lx in the “List.LastItem” and “List.UniqueItems” block? This possibility does not exist for me …

1 Like

can you show an image ?

try to expand the little arrow in right side and set to level2…hope it helps

1 Like

Hello
another solution

import sys
import re

listA = IN[0]
if all(re.search(r'(\d+[\,\.]\d+)', x) is not None for x in listA):
	listA.sort(key = lambda x : float(re.search(r'(\d+\.\d+)', x.replace(',','.')).group(1)))
OUT = listA
5 Likes

Thanks that was the mistake. It works.

1 Like

Yes @c.poupin great way too…your old python shark :wink: :wink:

2 Likes

Thanks for your solution. This will sort the values in pairs, right? I think it would work because I can now remove every second value.

the code sort list string by decimal value
a small change has been made

2 Likes