I have double checked the code and it finally works.
Now the problem is that it can’t just find part of the whole string “Level”
Change the “if item == test” to “if item in test”?
Nop
Have you tried pasting in the code I sent? I tested it out and it worked on my end.
And is there a reason you’re trying the python solution instead of the node one?
Edit: If you need to use python, this is actually a simpler method (using the test @3Pinter mentioned):
list = IN[0]
test = IN[1]
output = []
i=0
for sub in list:
if test in sub:
output.append(i)
i=i+1
OUT = output
Thank you guys for you help !
Hi there!
Is it possible to makes it work even when there is no list with “Level”?
And also when there are several lists that contain “Level”?
But it already works with several levels … This script returns all indexes of groups that contain a word “Level”. Or do you want to get some other output that are not these indexes?
The script returns all indexes but the problem is for “replace item at index”.
in the example it returns the indexes 7 and 8 but ionly the list 7 has been replaced
You can replace the item direct on the python script, to make it more compact, like this:
Or you need those indexes?
I think I need the indexes cause it places me the whole list in the indexes 7 and 8.
I have tried to combine the 2 python script but it doesnt work when there are empty lists
I think now I understand your situation… You have two lists with the same number of sublists… Then you want to replace the sublist “7” in one list with the sublist “7” of the other list, right? If so, this script will solve you problem:
Sorry, I uploded the wrong picture. Now it is correct
That Works perfectly @tiagocorradi for “Level” !! Thanks a lot!
Is there any way to make it work for several tests? Such as “Level” and “Family” at the same time?
Works perfectly !! thanks