escaping quotes

Fredrik Lundh fredrik at pythonware.com
Tue Feb 28 14:00:41 EST 2006


John Salerno wrote:

> I'm reading through the tutorial and found this in section 3:
>
>  >>> '"Isn\'t," she said.'
> '"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.'
'"Isn\'t," she said.'

with

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

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

</F>






More information about the Python-list mailing list