* [EMAIL PROTECTED] <[EMAIL PROTECTED]> [2008-05-10 13:59:37 -0700]: > 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;
That is because Python expects you to end the triple-quoted string with three unescaped quotes. > 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 > That ^Z just suspends your Python interpreter. It has become a job you can now bring to foreground again with "fg". (but it's a feature of your shell, not of 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? The fact is, that triple-quoted strings can span on multiple lines, and that single-quoted strings cannot (without the line ending with a "\"). So no, it's not a bug in the interpreter. Regards, -- Nicolas Dandrimont
signature.asc
Description: Digital signature
-- http://mail.python.org/mailman/listinfo/python-list