Oops, I didn't see Mac's reply until after I sent my message. Regex's
are probably the better way to do it than my way.
Justin
Mac Mason wrote:
>Regular expressions in python are slightly less handy than in perl, because
>they're implemented as a module, not as a built-in.
>The following should do the trick:
>
> >>> text = "This is a \'test\'"
> >>> print text
> This is a 'test'
> >>> import re
> >>> text2 = re.sub("\'", "", text)
> >>> print text2
> This is a test
>
>re is the regular expression module.
>Note that regular expression patterns are input as strings, unlike perl; this
>means you have to escape a lot more things. (Like that single-quote)
>
>For the whole shebang, have a look at
><http://www.python.org/doc/2.4/lib/module-re.html>
>
> --Mac
>
>
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Thu Mar 24 18:02:28 2005
This archive was generated by hypermail 2.1.8 : Thu Mar 24 2005 - 18:02:28 AKST