As a developer, I was cleaning up a dataset in Python where I had a list of customer names collected from an online survey. The issue? Some entries were completely blank. These empty strings were messing up my analysis, and I needed a quick way to remove them.
If you’ve ever worked with real-world data in the USA, like customer names, email addresses, or product reviews, you know how common it is to get lists with missing or empty values.
In this tutorial, I’ll show you multiple ways I personally use to remove empty strings from a list in Python. I’ll walk you through various methods, from simple built-in functions to list comprehensions, so you can choose the one that best fits your workflow.
Method 1: Use Python List Comprehension
In this Python method, we will iterate over the list using list comprehension and select only non-empty strings.
list_with_empty_strings = ['California', 'Texas', '', 'Florida', '', 'Alaska', 'Hawaii', '']
states = [x for x in list_with_empty_strings if x != '']
print(states) This list comprehension creates a new list containing only the elements from list_with_empty_strings that are not empty strings. It will remove empty strings from the original list in Python.
[x for x in list_with_empty_strings if x != '']Output:
['California', 'Texas', 'Florida', 'Alaska', 'Hawaii']I executed the above example code and added the screenshot below.

List comprehension in Python offers a shorter syntax when we want to create a new list based on the values of an existing list in Python.
Method 2: Use Python’s remove() Function
In Python, the remove() function accepts an element as an argument and removes the first occurrence of the given element from the list.
names = ["", "Jonny", "", "Louis", "", "Marsh","Alex"]
print("Original List: ",names)
while("" in names):names.remove("")
print("After removing empty strings from the list: ", names)Output:
Original List: ['', 'Jonny', '', 'Louis', '', 'Marsh', 'Alex']
After removing empty strings from the list: ['Jonny', 'Louis', 'Marsh', 'Alex']I executed the above example code and added the screenshot below.

This method repeatedly removes all empty strings from the list by using the remove() function in a loop.
Method 3: Use the len() with remove() in Python
This is another way to remove strings from a list of strings using the len() with the remove() function in Python. Empty strings are of 0 length. So, we can check the length of all strings in the list and remove the strings with a length of 0.
car_list=["BMW","","Audi","","Chevrolet",""]
print("Existing list-",car_list)
for name in car_list[:]:
if(len(name)==0):
car_list.remove(name)
print("List after removing empty strings: ",car_list)Output:
Existing list- ['BMW', '', 'Audi', '', 'Chevrolet', '']
List after removing empty strings: ['BMW', 'Audi', 'Chevrolet']I executed the above example code and added the screenshot below.

Iterate over a sequence of a list of strings, and for each element, check if its length is 0 or not. If yes, remove that string from the Python list using the remove() function.
Method 4: Use Python filter() Function
The filter() function returns the given sequence with the help of a function in Python that tests each element in the sequence to be True or False.
list_with_empty_cities = ['New York', 'Chicago', '', '', '', 'Dallas', 'Phoenix', '']
new_list_of_cities = list(filter(None, list_with_empty_cities))
print(new_list_of_cities)Output:
['New York', 'Chicago', 'Dallas', 'Phoenix']I executed the above example code and added the screenshot below.

This method uses the filter() function to efficiently remove all empty strings from the list, returning only non-empty elements.
Method 5: Use filter() and lambda() in Python
In Python, the lambda function can take any number of arguments but only has one expression.
empty_string_list = ['Sailing', '', 'Kite Sufring', 'Scuba Diving', '', 'Snorkeling', '']
list_of_water_sports = list(filter(lambda x: x != '', empty_string_list))
print(list_of_water_sports)The lambda function in Python checks if each element x is not equal to an empty string, and only elements that satisfy this condition are included in the new list.
list_of_water_sports = list(filter(lambda x: x != '', empty_string_list))Output:
['Sailing', 'Kite Sufring', 'Scuba Diving', 'Snorkeling']I executed the above example code and added the screenshot below.

This method uses filter() with a lambda function to remove empty strings, keeping only non-empty elements in the list.
Method 6 : Use Python’s join() and split()
This is another way to remove strings from a list of strings using join() and split(). Using this join() and split(), it will first join all the strings so that space is removed, and then split it back to the list so that the new list made now has no empty string in Python.
USA_lake_with_emptylist = ["", "Michigan", "", "Ontario", "Huron", "", "Erie "]
print("Original list is : " + str(USA_lake_with_emptylist))
USA_lake_with_emptylist = ' '.join(USA_lake_with_emptylist).split()
print("Modified list is : " + str(USA_lake_with_emptylist))Here, it will split into a list of substrings using spaces as separators with a join() function and then split the resulting string back into a list using spaces as separators with the .split() method.
USA_lake_with_emptylist = ' '.join(USA_lake_with_emptylist).split()
print("Modified list is : " + str(USA_lake_with_emptylist))Output:
Original list is : ['', 'Michigan', '', 'Ontario', 'Huron', '', 'Erie ']
Modified list is : ['Michigan', 'Ontario', 'Huron', 'Erie']I executed the above example code and added the screenshot below.

This method removes empty strings by joining list elements into a single string and splitting them back into a clean list.
Method 7: Use For Loop
You can also remove empty strings from a list of strings in Python using a for loop, as we can iterate over the string characters.
empty_list_of_strings = ["GAP", "", "", "Peter England", "Dior", "Louis Vuittion"]
updated_list = []
for element in empty_list_of_strings:
if element != '':
updated_list.append(element)
print(updated_list)It iterates over each element in the given list using a for loop in Python. If the element is not an empty string, append it to updated_list.
for element in empty_list_of_strings:
if element != '':
updated_list.append(element)Output:
['GAP', 'Peter England', 'Dior', 'Louis Vuittion']I executed the above example code and added the screenshot below.

This method uses a for loop to filter out empty strings and build a new list with only non-empty elements.
Method 8: Use the enumerate() Function
In Python, the enumerate() function takes a collection and returns it as an enumerate object. This function adds a counter as the key of the enumerated object.
input_list_with_strings = [' ', 'Lidia', ' ', 'Jonny', 'Alster', ' ', 'Mitchell']
result_list = [i for a,i in enumerate(input_list_with_strings) if i!=' ']
print (result_list)Output:
['Lidia', 'Jonny', 'Alster', 'Mitchell']I executed the above example code and added the screenshot below.

This method uses the enumerate() function with list comprehension to remove empty string elements and create a filtered list.
I hope this Python article provided sufficient information on how to remove empty strings from a list of strings in Python.
Here, I have explained different methods with illustrative examples like using list comprehension, remove() function, filter() function, filter()and lambda function, split(), for loop, and enumerate() function in detail.
I hope you will use the methods according to your requirements.
You may also like to read:
- Print Strings and Variables in Python
- Python Naming Conventions for Variables
- Save Variables to a File in Python
- Set Global Variables in Python Functions

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.