Python, are you ill?

Ludwig ludwigbrinckmann at gmail.com
Sat May 10 17:08:36 EDT 2008


This is not a bug, this is how it should work.

A triple quoted string ends only with another triple quoted string (which
can extend over multiple lines) In your example you are escaping the first
quote character at the end of the line, thus leaving just two quotes that do
not end the string.
Another """ (triple quote) will terminate the string.

HTH


2008/5/10 <wxPythoner at gmail.com>:

> If you are in the interactive prompt of the Python interpreter and you
> do this
>
> print """Testing\"""   or   print '''Testing\'''
>
> you get three dots [...] as if Python expects a code block. If you
> press Enter, you get three dots again, and again, and again... You
> can't get out of the code block with pressing the Enter key; you have
> to press Ctrl+Z (if you're in Linux) in order to get out of that code
> block, which then throws you back to the Linux command line, but
> before that it prints this line
>
> [1]+  Stopped                 python
>
>
> If you do
>
> print "Testing\"   or   print 'Testing\'
>
> you get an error, but not of you use the triple quotes. Is that a bug
> in the interpreter perhaps?
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080510/ac8530ed/attachment.html>


More information about the Python-list mailing list