Python, are you ill?

Tim Roberts timr at probo.com
Sun May 11 19:26:07 EDT 2008


wxPythoner at gmail.com wrote:
>
>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.

...which it does.

>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, 

No, you don't.  You can also enter """ or ''' to properly close the quote.

>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?

As a general rule, when you are just beginning to learn some product, it is
safe to assume that anything you see as a bug in the product is almost
certainly a flaw in your understanding of the product.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list