[Tutor] escape-quoting strings

Chad Crabtree flaxeater at yahoo.com
Mon Nov 1 03:04:00 CET 2004


Marilyn Davis wrote:

>I got it!!
>
>This works:
>
>ad0 = address.replace('\\', '\\\\')
>ad0 = ad0.replace('\"','\\"')
>db_style0 = '''%%%s%%''' % ad0
>print "0:", db_style0
>
I thought I should tell you about raw strings  eg.

r'\new'

out puts
\new

not
<newline>
ew

the r at the front automaticly escapes special characters.


		
__________________________________
Do you Yahoo!?
Y! Messenger - Communicate in real time. Download now. 
http://messenger.yahoo.com


More information about the Tutor mailing list