Single string print statements on multiple lines.

Diez B. Roggisch deets at nospam.web.de
Mon Mar 12 13:23:37 CET 2007


HeEm wrote:

> In my 100 level CS course, I was asked to create multiple lines of
> output within a single string.  Of course I know how to:
> 
> print "I am"
> print "a python"
> print "newbie."
> 
> How can I get this accomplished using a single string (assuming this
> means a one line statement).  Is there and escape character or
> something that could be added?
> 
> Thanks for any help that can be provided.

The usual one: \ 

Do

"first line\nnextline"

Diez



More information about the Python-list mailing list