Python, are you ill?

John Machin sjmachin at lexicon.net
Sat May 10 17:05:31 EDT 2008


On May 11, 6:59 am, wxPytho... 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. 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?

No. This might clue you in:

>>> print """Testing\""""
Testing"
>>>

Cheers,
John



More information about the Python-list mailing list