[Tutor] Newline question

Jerry Hill malaclypse2 at gmail.com
Fri Aug 3 22:40:54 CEST 2012


On Fri, Aug 3, 2012 at 4:18 PM, Alexander Q. <redacted@example.com> wrote:
> 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.

You left out the other line of code in the tutorial, which says you
need to do print(hello) to the the output that is described. Did you
do that?  If so, it should work fine.  If not, what did you do
instead?  If you just typed:

>>>hello

at the interpreter prompt, then you are actually seeing the equivalent
of print(repr(hello)), instead of print(hello).

Can you copy and paste your session for us?

Jerry


More information about the Tutor mailing list
l>