It seems like there should be a simpler way than:
import string s = \"string. With. Punctuation?\" # Sample string out = s.translate(string.maketrans(\"\",\
Regular expressions are simple enough, if you know them.
import re s = "string. With. Punctuation?" s = re.sub(r'[^\w\s]','',s)