How to remove a character from a list of strings in Python

Removing a character from a list of strings removes every instance of the character from all the strings in the list. For example, removing “e” from [“hello”, “there”] results in [“hllo”, “thr”].

Solution for How to remove a character from a list of strings in Python : You can use str.replace() and list comprehension to remove a character from a list of strings Use the syntax [new_string for string in list] with new_string as string.replace(char, “”) and list as a list of strings to create a list containing each string in list with each instance of char replaced with “”.


how-to-remove-a-character-from-a-list-of-strings-in-python