Q: quoting string without escapes

Daniel Bickett dbickett at gmail.com
Mon Jan 31 16:27:48 EST 2005


On Mon, 31 Jan 2005 14:09:10 -0500, Steve Holden <steve at holdenweb.com> wrote:
>      Use triple-quoting.

An example, for the sake of examples:

Python 2.3.4 (#53, May 25 2004, 21:17:02) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> string = """ " ' " ' " ' " ' \""" """
>>> string
' " \' " \' " \' " \' """ '
>>> string = """
... "
... "
... "
... '
... '
... '
... \"""
... "\""
... ""\"
... """
>>> string
'\n"\n"\n"\n\'\n\'\n\'\n"""\n"""\n"""\n'

-- 
Daniel Bickett
dbickett at gmail.com
http://heureusement.org/



More information about the Python-list mailing list