quoting strings

2006-01-31 Thread Michal Duda
Hi, is any equivalent to perl quotemeta function in python? I know that I can use this on string: r'\\test' but I need to do this on the variable Thanks in advance Michal -- http://mail.python.org/mailman/listinfo/python-list

Re: quoting strings

2006-01-31 Thread Fredrik Lundh
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 --

Re: 20050119: quoting strings

2005-01-10 Thread Steve Holden
Xah Lee wrote: #strings are enclosed in double quotes quotes. e.g. a=this and that print a #multiple lines must have an escape backslash at the end: b=this\n\ and that print b #One can use r for raw string. c=rthis\n\ and that print c #To avoid the backslash escape, one can use triple double