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
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
--
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