[CentralOH] Removing Punctuation

Eric Floehr eric at intellovations.com
Tue Jan 21 01:20:07 CET 2014

> Hmm, now I wonder how do I use the str.translate() method in Python 3 to
> get rid of the
> punctuation marks?

>>> import string
>>> S = "Some, string! With punctuation."
>>> S.translate(S.maketrans("", "", string.punctuation))
'Some string With punctuation'

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/centraloh/attachments/20140120/bcfd8a22/attachment.html>

More information about the CentralOH mailing list