Python-equivalent of PHP addslashes/stripslashes functions?

maxm maxm at
Thu Nov 1 00:05:55 CET 2001


Return string with all non-alphanumerics backslashed; this is useful if you
want to match an arbitrary literal string that may have regular expression
metacharacters in it.

regards Max m

"Leeuw van der, Tim" <tim.leeuwvander at> wrote in message
news:mailman.1004529931.3668.python-list at
> Hello,
> I'd like to know if there's a Python-alternative to the very convenient
> functions addslashes / stripslashes which add cq remove backslashes to
> things like ', " characters, so that values from HTML forms can be safely
> passed around to other programs, used in SQL statements, etc.
> Any pointers?
> Thanks in advance,
> --Tim

More information about the Python-list mailing list