How to split list into several lists based on criterium

Hi,
I have a list of lists of elements and I need to split each list into several lists whenever I find an element which is not a pipe.

So my output needs to be:
0 List
0 Pipe 659762
1 Pipe 659777
2 Pipe 659793
1 List
0 Pipe 659801
2 List
0 Pipe 659866

Can I do this without resorting to Python?

Start by identifying your non-pipe elements. From there you’ll have a better idea of what you can do to separate your lists.

I can identify my non-pipe elements, no problem. I’ll get their category and I can imagine filtering them out of the original list with a FilterByBoolMask node. I’m just not sure how I can replace those elements for a list…

Let see what you have so far so we can better suggest how to move forward.

@RuiBarreiros have you tried getting the indices of those items and then list.chop ?

1 Like

Thanks @Daan for pointing the way forward.
I figured it out.

There may be easier ways but it works.
For anyone interested, the python code goes like this:

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

# Place your code below this line
indexes = IN[0]
totals = IN[1]
output = []
k=0
for index in indexes:
	temp=[]
	prev=0
	last=0
	for i in index:
		j=i-prev
		prev=i
		temp.append(j)
	last = totals[k]-i
	k=k+1
	temp.append(last)
	output.append(temp)
		
# Assign your output to the OUT variable.
OUT = output