Get index of "Empty List"

Hi folks,
I’m struggling with the list now. I’m wondering if I can get the index of Empty List from a list.
Kindly take a look at the picture
Anyone has solutions ? thanks

1 Like

Use List.IsEmpty with Longest lacing or list levels.

2 Likes

thank you Nick for swift response,
now I’ve got there, what to do next ?

1 Like

You can make a python script,

b=IN[0]
L=[]
for i in b:
if b[i]==True:
L=L+[i]
OUT = L

I don’t know how to implement on this site sorry
In true python it will work… With dynamo I don’t know…

You could also use List.FilterByBoolMask, using List.isEmpty as Mask

1 Like

@truongbaolam0209 attach a List.AllIndicesOf node to List.IsEmpty with the boolean true as the item input

4 Likes

it is not working, could you pls elaborate more ? thanks

@awilliams
i can’t get it, could you pls elaborate more ? thanks

Assuming you want the indices so that you can then get elements at those same indices, you can just use FilterByBoolMask to filter your elements based on the true/false values you get.

11 Likes

@awilliams
i’ve got it, many thanks

@Nick_Boyts
i’ve got it, you are the man, many thanks

hi @Nick_Boyts
last silly question is how to close the topic
thanks

Mark the reply that helped you solve the issue as the Solution.
image

1 Like

You could just use OOTB List.Clean. it takes care of any list structure

image

image

2 Likes

@salvatoredragotta
i’vs got it.thanks

@Nick_Boyts
silly me again, i can’t find the Mark Solution

image

Go to the post with the answer of your topic and you will find this element

1 Like

Make sure you mark the solution for the question you posted about, not any subsequent questions. The whole point of marking a solution is so that other people with the same question can quickly find an answer in your post.

2 Likes