even for people who don’t understand regex like me - this is still the fastest way to clean up a string with punctuation.
it replaces not word characters or spaces with empty string - see here for full answer from stackoverflow: https://stackoverflow.com/questions/265960/best-way-to-strip-punctuation-from-a-string-in-python
import re s = "string. (With.) Punctuation?" s = re.sub(r'[^\w\s]','',s)