Converting Empty List To Zero

Hello everyone
I have a list in Dynamo that consists of numbers and empty lists as you see in uploaded image, and i need to convert empty lists into zero numbers, in other words i want to have 0 instead of each empty list in the main list. anyone can help me?
Thank you so much!

I don’t know why all the normal ways don’t seem to be working but you can always use Python.

list = IN[0]
replace = IN[1]
out = []

for l in list:
	if l == []:
		out.append(replace)
	else:
		out.append(l)
#Assign your output to the OUT variable.
OUT = out
1 Like

Yeah, empty lists in Dynamo are terrible to work with. Maybe this is of some help:

The custom node is from Clockwork

1 Like

That’s weird, @T_Pover cause my ReplaceEmptyLists node wasn’t working.

1 Like

Thanks you all so much @T_Pover @Nick_Boyts
it works correctly!