i have this sublist… from these sublists i want the first and the last item but keep the list structure…
i tried it with the first and last node… but that doesn’t keep the list structure… the same if i try something with count… then the list structure is gone as well… how can i solve this
so the result is the same list only where there are now 4 surfaces there need to be 2 surfaces
Hello
Not sure…but could springs help you ?
your losing the list structure… with this node unfortunatly
am thinking along this lines at the moment… but not keeping the structure completely in tact but it is oke for the thing i need… but better solutions are welcome
That can help
liste = IN[0]
output = []
for el in liste:
output.append([el[0], el[-1]])
OUT = output
Edit: I see you have another level in your list so you can use that one:
liste = IN[0]
output = []
for el in liste:
temp = []
for i in el:
temp.append([i[0], i[-1]])
output.append(temp)
OUT = output
Forget List.Map
. It’s old and antiquated. List levels are easier and give you more control. It’s definitely possible with FirstItem
/LastItem
, you just need to get the list levels right and use “Keep list structure”.
Click on the little arrow on the right of the input port label to access levels and check Keep list structure.
firstLast.dyn (10.8 KB)
3 Likes