# Converting Empty List To Zero

**URL:** <https://forum.dynamobim.com/t/converting-empty-list-to-zero/13669>\
**Category:** Revit\
**Created:** [August 2, 2017, 12:22pm UTC](https://forum.dynamobim.com/t/converting-empty-list-to-zero/13669 "2017-08-02T12:22:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joe1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/joe1/32/27963_2.png) [@Joe1](https://forum.dynamobim.com/u/Joe1)\
**Post date:** [August 2, 2017, 12:22pm UTC](https://forum.dynamobim.com/t/converting-empty-list-to-zero/13669/1 "2017-08-02T12:22:15Z")

</div>

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!

 ![2016 - Copy (2)](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/9/d9097f577065f3226938fe75d0ca265137e045a3.jpg)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 2, 2017, 12:44pm UTC](https://forum.dynamobim.com/t/converting-empty-list-to-zero/13669/2 "2017-08-02T12:44:36Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![T\_Pover](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/t_pover/32/19147_2.png) [@T\_Pover](https://forum.dynamobim.com/u/T_Pover)\
**Post date:** [August 2, 2017, 12:46pm UTC](https://forum.dynamobim.com/t/converting-empty-list-to-zero/13669/3 "2017-08-02T12:46:44Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/9/794c487da7c67e358908dfd7ae8ac524f73a4bfe.png)

The custom node is from Clockwork

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [August 2, 2017, 12:50pm UTC](https://forum.dynamobim.com/t/converting-empty-list-to-zero/13669/4 "2017-08-02T12:50:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Joe1](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/joe1/32/27963_2.png) [@Joe1](https://forum.dynamobim.com/u/Joe1)\
**Post date:** [August 2, 2017, 12:58pm UTC](https://forum.dynamobim.com/t/converting-empty-list-to-zero/13669/5 "2017-08-02T12:58:57Z")

</div>

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