# Removing empty lists

**URL:** <https://forum.dynamobim.com/t/removing-empty-lists/1271>\
**Category:** Packages\
**Created:** [March 31, 2015, 9:44pm UTC](https://forum.dynamobim.com/t/removing-empty-lists/1271 "2015-03-31T21:44:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul\_Wintour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paul_wintour/32/9381_2.png) [@Paul\_Wintour](https://forum.dynamobim.com/u/Paul_Wintour)\
**Post date:** [March 31, 2015, 9:44pm UTC](https://forum.dynamobim.com/t/removing-empty-lists/1271/1 "2015-03-31T21:44:01Z")

</div>

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

Hi

Is there a way to remove empty list from a list? Grasshopper has a ‘clean tree’ component but I can’t seem to find the equivalent in Dynamo. Thanks

&nbsp;

![CleanList](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/1/1a74601337a2b04baa0b524688433e7c138c2828.jpg)

---

<div class="post-metadata">

**Author:** ![Andreas\_Dieckmann](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/andreas_dieckmann/32/365_2.png) [@Andreas\_Dieckmann](https://forum.dynamobim.com/u/Andreas_Dieckmann)\
**Post date:** [March 31, 2015, 10:46pm UTC](https://forum.dynamobim.com/t/removing-empty-lists/1271/2 "2015-03-31T22:46:08Z")

</div>

![RemoveEmptyLists](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/6/6b6cb7e64780160b22042f6e7560a8af3ccb3721.png)

---

<div class="post-metadata">

**Author:** ![Paul\_Wintour](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/paul_wintour/32/9381_2.png) [@Paul\_Wintour](https://forum.dynamobim.com/u/Paul_Wintour)\
**Post date:** [March 31, 2015, 11:13pm UTC](https://forum.dynamobim.com/t/removing-empty-lists/1271/3 "2015-03-31T23:13:35Z")

</div>

Thanks. I though flatten would do the trick but I was using List.Flatten (which obviously didn’t work). Why have two flattens? Whats the difference?

---

<div class="post-metadata">

**Author:** ![Andreas\_Dieckmann](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/andreas_dieckmann/32/365_2.png) [@Andreas\_Dieckmann](https://forum.dynamobim.com/u/Andreas_Dieckmann)\
**Post date:** [April 1, 2015, 12:29am UTC](https://forum.dynamobim.com/t/removing-empty-lists/1271/4 "2015-04-01T00:29:02Z")

</div>

List.Flatten allows you to specify the amount, i.e. the number of hierarchies you want to get rid of:

![FlattenVsFlatten](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex022/uploads/dynamobim/original/2X/8/800ec14c6dca3f2637aad1beece5c7d4132be372.png)
