if a list element is empty delete code example
Example 1: python remove empty list
list2 = filter(None, list1)
Example 2: how to remove empty elements in a list python
without_empty_strings = [string for string in a_list if string != ""]
list2 = filter(None, list1)
without_empty_strings = [string for string in a_list if string != ""]