[Tutor] Python using version 3.1
hugo.yoshi at gmail.com
Sun Dec 19 05:13:29 CET 2010
On Sun, Dec 19, 2010 at 4:42 AM, Lea Parker <lea-parker at bigpond.com> wrote:
> I am working through a purchased text book Python programming for beginners.
> Chapter two shows how to create a basic program using triple-quoted strings.
> I am having problems working out what I have done incorrectly. The game over
> block writing should stay on the same line but the bottom half of the word
> over comes up next to the top half of the word over. Hope that makes sense.
It's the backslashes.
A backslash at the end of a line means to disregard the newline. You
need to "escape" the backslash with another backslash. See here:
>>> print """this string \
... won't have a newline, or a slash in it"""
this string won't have a newline, or a slash in it
>>> print """this string \\
this string \
The R ends in backslashes, so you need to double those up.
More information about the Tutor