Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > escaping quotes

Reply
Thread Tools

escaping quotes

 
 
John Salerno
Guest
Posts: n/a
 
      02-28-2006
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?
 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      02-28-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>



 
Reply With Quote
 
 
 
 
John Salerno
Guest
Posts: n/a
 
      02-28-2006
Fredrik Lundh wrote:

> 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!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Escaping Quotes in HMTL/ASPX? ResolveUrl?? <% jc ASP .Net 2 03-19-2008 05:41 PM
escaping only double quotes cesco Python 2 08-31-2007 04:43 PM
Escaping quotes withing quotes duwayne@gmail.com Javascript 7 05-17-2005 06:17 PM
JSTL and Escaping Quotes (Newbie Question) DartmanX Java 1 01-23-2005 07:11 AM
Multiline quotes - escaping quotes - et al Lawrence Tierney Java 3 12-24-2003 05:12 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57