[Tutor] FW: wierd replace problem
Francesco Loffredo
fal at libero.it
Tue Sep 14 20:11:04 CEST 2010
On 14/09/2010 18.35, Roelof Wobben wrote:
> ...
> It was not confusing when I read your explanation.
> Still im grazy wht with you and Joel the strip works and with me I get errors.
>
> But how can I use the triple quotes when reading a textf-file ?
Very easy: YOU DON'T NEED TO USE ANY QUOTES.
All the quoting stuff is ONLY needed for literals, that is for those
strings you directly write in a program. For example:
MyString = """ these are my favourite quoting characters: "'` """ #
here you need to avoid ambiguities, because quoting chars are also used
to start and end the string.
You could obtain EXACTLY the same string with backslash-quoting:
YourString = ' these are my favourite quoting characters: "\'` ' # here
I had to quote the single-quote char
HerString = " these are my favourite quoting characters: \"'` " # and
here the double quote had to be quoted by backslash
But when you DON'T write the string yourself, you don't need any quoting:
ThisString = MyString + YourString + HerString # no quoting required
ThatString = file.read() # again, NO QUOTING REQUIRED.
> Roelof
Francesco
-------------- next part --------------
Nessun virus nel messaggio in uscita.
Controllato da AVG - www.avg.com
Versione: 9.0.851 / Database dei virus: 271.1.1/3132 - Data di rilascio: 09/13/10 08:35:00
More information about the Tutor
mailing list