List of lists is a list that contains lists as its elements.
We have a list that contains other lists (empty and non-empty). And we need to return a list that does not contain any empty string.
To perform this task, we need to iterate the list and then in the resultant list exclude all the empty elements.
Program to remove the empty list from a list of lists
Output:
Another method
Python provides its users with in-built functions on data structures to perform the task easily.
On such method is filter() method
Syntax:
Program to remove the empty list from a list of lists using filter() method
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer