Remove all punctuation from string

PHOTO EMBED

Sun Nov 12 2023 12:07:18 GMT+0000 (Coordinated Universal Time)

Saved by @pika8oo #python #regex

import re
s = "string. With. Punctuation?"
s = re.sub(r'[^\w\s]','',s)
# \w matches any word character (equivalent to [a-zA-Z0-9_])
# \s matches any whitespace character (equivalent to [\r\n\t\f\v ])
content_copyCOPY