How to Remove Punctuation from a List in Python
If you have a Python list, and want to remove all punctuation, then you can do the following:
First get all punctuation by using string.punctuation 1 2 import string print(string.punctuation) Output:
1 !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ Option 1 – Using for 1 2 3 4 5 6 7 8 9 10 11 12 import string words = ["hell'o", "Hi,", "bye bye", "good bye", ""] new_words = [] for word in words: if word == "": words.