It seems like there should be a simpler way than:
import string s = \"string. With. Punctuation?\" # Sample string out = s.translate(string.maketrans(\"\",\
Considering unicode. Code checked in python3.
from unicodedata import category text = 'hi, how are you?' text_without_punc = ''.join(ch for ch in text if not category(ch).startswith('P'))