Get index number

Hello :slight_smile:

I have this list :

How can I get the index number of nonempty index : Here I want the list {1;2;3;8;9} and another list with empty index {0;4…7;10…13}

Thank you :slight_smile:

Start with this:

Thank you tomasz,
I don’t know why but it doesn’t works

That is because the line

if e is not None:

only works for “null” values, not empty strings.

try this instead:

if e == "":

Yep I understand but it doesn’t work to.

remplace “” by " " do not change the error message :s

please try
i == "":


1 Like

This is not exactly what I want
In your example I want the values : {0,1,2,3,5,7,8}
,but thank’s a lot !

I have found the solution to get empty index value :

Thanks all for your help !

1 Like

Great to hear, the reason the other wasn’t working was because of the double “” (quotes). We need to use single quotes to escape that.


lst = IN[0]
items = []
emp = []

for i, e in enumerate(lst):
	if lst[i] != '':

#Assign your output to the OUT variable.
OUT = items,emp";
1 Like

@SeanP Yes !!! That exactly what I want !!
Thank’s a lot Sean :wink: