Skip to content
Advertisement

Delete empty lists from tuple from inside a list

I have a list of tuples which in turn have 2 elements and a list. I wish to delete the tuples that have empty lists.

JavaScript

Expected output:

JavaScript

I tried :

JavaScript

It throws me a Memory Error

Advertisement

Answer

One way using list comprehension with unpacking:

JavaScript

Output:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement