Quotes

Chad Netzer cnetzer at mail.arc.nasa.gov
Fri Dec 20 15:18:48 EST 2002


On Friday 20 December 2002 10:05, Tetsuo wrote:
> All your suggestions can be broken if the outermost quotes are
> the same as something in the text...

If you are algorithmically generating your strings (so that you 
don't necessarily know what quote characters are used inside them  
ahead of time), I think the best thing would be to always expand 
all instances of " or ', within the string, to \" and \' 
respectively.  Then you can use any style of outer quote you want 
and it shouldn't break.  And I think it is a clearer style than 
using chr().

-- 
Bay Area Python Interest Group - http://www.baypiggies.net/

Chad Netzer
cnetzer at mail.arc.nasa.gov




More information about the Python-list mailing list