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
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: 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
Hello Richard, On Sun, Aug 5, 2012 at 8:40 AM, Richard Hendricks <richardhendricks@yahoo.com> wrote:
Hello, Looks like there has been a format change in a recent version that has not propagated to documentation?
This documentations is for Python 2.7, but...
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:
...you're running Python 3.2. First of all, you'd have to look at the right doc: http://docs.python.org/py3k/
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
and to clarify, in Python 3.x print() has become a function, so you have to pass what you want to print as argument to print(). Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi
participants (2)
-
Richard Hendricks
-
Sandro Tosi