I know there are tons of examples about removing punctuation but I want to know the most efficient way to do this. I have a list of words that I read from a txt file and split
wordlist = open('Tyger.txt', 'r').read().split()
What is the fastest way to check each word and remove any punctuation? I can do it with a bunch of code but I know it is not the easiest way.
Thanks!!
I think the easiest way is to only extract words consisting of letters in the first place:
import re
with open("Tyger.txt") as f:
words = re.findall("\w+", f.read())