[Help] HOW TO KEEP THE LIST STRUCTRE WHEN TAKE ITEMS FROM A LIST

Hi there,

I use “List.GetItemAtIndex” scripts to get a specific value from many lists. However, the result returns me the proposed values only but without keep the list structure. From my understanding, it should keeps the list structure if i tick the "keep list structure"box up, and should return me the values with the list structure together. Please let me know how to solve it. Thanks in advance.

Note: There are 3 lists in the attached screenshoot is just for the example. I got heaps of lists in reality.

@Seanc9XFAH

short answer : List.Chop node might help you get the list structure correct.

Long Answer : The list which you are passing on to get item at index is a single list of 3 sublists. That’s the reason the outcome at index is just a single list. but if you create a combination of lists by joining 3 lists together then each list will have a sublist and list structure can be maintained as expected (top most workflow of above image). To achieve expected result you need to divide single list in to group of multiple lists and that can be done using List.chop node, there are multiple ways to split a list in to sublist. Hope This helps

2 Likes

Hi @Seanc9XFAH

Or you can just use this one line of python:

OUT = [[e[index]] for index in [IN[1]] for e in IN[0]]

5 Likes

Thank you for your description. The problem has been solved.

Thanks for your python scripts. It works very well for me.