[docs] print "Hello World" not working

Richard Hendricks richardhendricks at yahoo.com
Sun Aug 5 08:40:40 CEST 2012


Hello,
  Looks like there has been a format change in a recent version that has not propagated to documentation?

http://docs.python.org/tutorial/introduction.html#strings

has example

hello = "This is a rather long string containing\n\ several lines of text just as you would do in C.\n\ Note that whitespace at the beginning of the line is\ significant." print hello

However, when I try to use that in a plain 3.2.3 install on a PC:
>>> hello = "This is a rather long string containing\n\
... several lines of text just as you would do in C.\n\
...     Note that whitespace at the beginning of the line is\
...  significant."
>>>
>>> print hello
File "<stdin>", line 1
print hello
^
SyntaxError: invalid syntax
>>>

...but this works...

>>> print (hello)
This is a rather long string containing
several lines of text just as you would do in C.
Note that whitespace at the beginning of the line is significant.
>>>

Thank you.


 
-- "Every gun that is made, every warship launched, every rocket fired signifies, in the final sense, a theft from those who hunger and are not fed, those who are cold and are not clothed. This world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children..."  -- Dwight D Eisenhower
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20120804/3d13756b/attachment-0001.html>


More information about the docs mailing list