quoting strings

M

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
 
F

Fredrik Lundh

Michal said:
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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,607
Members
45,240
Latest member
pashute

Latest Threads

Top