Best way to strip punctuation from a string in Python

Posted by Lawrence Johnston on Stack Overflow See other posts from Stack Overflow or by Lawrence Johnston
Published on 2008-11-05T17:30:32Z Indexed on 2010/03/08 15:21 UTC
Read the original article Hit count: 411

Filed under:
|

It seems like there should be a simpler way than:

import string
s = "string. With. Punctuation?" # Sample string 
out = s.translate(string.maketrans("",""), string.punctuation)

Is there?

© Stack Overflow or respective owner

Related posts about python

Related posts about string-manipulation