I'm following the tutorial from python.org ( http://docs.python.org/tutorial/introduction.html) and am having a few indiscrepancies regarding the new line command.
The tutorial says that this code 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." should yield this output: 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. When I run it in the interpreter however, I get the following output: 'This is a rather long string containing\nseveral lines of text just as you would do in C.\n Note that whitespace at the beginning of the line is significant.' The interpreter is not reading the "\n" as new lines but is instead printing them. If I just type something like hello = "This is a rather long string containing \ several lines of text." the output is all on one line, like this: "This is a rather long string containing several lines of text." So I know how to combine code that spans multiple lines to be outputted on one line, but I do not know how to make a newline appear in the output upon command (on account of the interpreter not reading the \n). Any suggestions as to why my output varies from the output in the tutorial? I am running a 2.7 version of Python, btw, and the tutorial is running a higher version I believe (3. something). Thank you. -Alex
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor