[Tutor] escape-quoting strings
Marilyn Davis
marilyn at deliberate.com
Mon Nov 1 23:08:48 CET 2004
On Sun, 31 Oct 2004, Chad Crabtree wrote:
> 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'
Thank you Chad. This might be helpful in another circumstance.
It goes to show that I'm clueless without the help here!
Marilyn
>
> 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