Hello
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
Hello
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
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 == "":
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 !
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] != '':
items.append(i)
else:
emp.append(i)
#Assign your output to the OUT variable.
OUT = items,emp";