escaping quotes

J

John Salerno

I'm reading through the tutorial and found this in section 3:
'"Isn\'t," she said.'


Why doesn't the escape sequence work in this case?
 
F

Fredrik Lundh

John said:
I'm reading through the tutorial and found this in section 3:

'"Isn\'t," she said.'

Why doesn't the escape sequence work in this case?

because the interactive prompt echos the result back to you as
a Python literal, where possible. compare
'"Isn\'t," she said.'

with
"Isn't," she said.

(this is explained a little later in the chapter you're reading)

</F>
 
J

John Salerno

Fredrik said:
because the interactive prompt echos the result back to you as
a Python literal, where possible. compare

Ah, of course! I forgot it wasn't 'print'ing it.

Thanks!
 

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,768
Messages
2,569,575
Members
45,054
Latest member
LucyCarper

Latest Threads

Top