Re: quoting strings
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: quoting strings

From: Fredrik Lundh <fredrik@pythonware.com>
Date: Tue Jan 31 2006 - 14:49:31 CET

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>
Received on Tue Feb 7 20:21:11 2006