On Fri, Sep 4, 2009 at 1:34 PM, GoodPotatoes wrote:
> I simply want to remark out all non-word characters read from a line.
>
> Line:
> Q*bert says "#...@!$% "
>
> in Perl
> #match each non-word character, add "\" before it, globally.
>
> $_=s/(\W)/\\$1/g;
>
> output:
> Q\*bert\ says\ \"\...@\!\$\
I simply want to remark out all non-word characters read from a line.
Line:
Q*bert says "#...@!$% "
in Perl
#match each non-word character, add "\" before it, globally.
$_=s/(\W)/\\$1/g;
output:
Q\*bert\ says\ \"\...@\!\$\%\ \ \" #perfect!
Is there something simple like this in python?
I