Python: Removing empty lists from mixed nested lists
www.emilkirkegaard.com
Suppose you have some function that returns possibly nested lists with empty lists inside. Worse, they may have lists with lists with an empty list inside. And suppose you want to get rid of all the empty lists, including those that just have other lists with empty lists inside. Like this:
Python: Removing empty lists from mixed nested lists
Python: Removing empty lists from mixed…
Python: Removing empty lists from mixed nested lists
Suppose you have some function that returns possibly nested lists with empty lists inside. Worse, they may have lists with lists with an empty list inside. And suppose you want to get rid of all the empty lists, including those that just have other lists with empty lists inside. Like this: