[CentralOH] Removing Punctuation: Replace Punctuation With Spaces

jep200404 at columbus.rr.com jep200404 at columbus.rr.com
Tue Jan 21 04:23:17 CET 2014


On Mon, 20 Jan 2014 21:24:50 -0500, pybokeh <pybokeh at gmail.com> wrote:

> I thought I could replace a punctuation mark with a single white space 
> by doing this:
> S.translate(S.maketrans(" ", " ", string.punctuation))
> 
> But that didn't work.  Any ideas how to replace a punctuation mark with 
> a single white space?

Here's an untested ugly idea: 

    S.translate(
        S.maketrans(string.punctuation, " " * len(string.punctuation))


More information about the CentralOH mailing list