python check for empty list remove() code example
Example 1: remove empty strings from list python
without_empty_strings = [string for string in a_list if string != ""]
Example 2: python remove empty list
list2 = filter(None, list1)
without_empty_strings = [string for string in a_list if string != ""]
list2 = filter(None, list1)