remove element from list python which are empty 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)