quoting strings

Fredrik Lundh fredrik at pythonware.com
Tue Jan 31 08:49:31 EST 2006


Michal Duda wrote:

> is any equivalent to perl "quotemeta" function in python?

s = re.escape(s)

> I know that I can use this on string: r'\\test'
> but I need to do this on the variable

your example is a string literal, which isn't really the same thing as
a RE pattern in Python.

</F> 






More information about the Python-list mailing list