Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Python Basics (2015) Python Data Types Strings

Python """ quote question

Hi just a quick question. When using the triple quote python is suppose to leave the empty space when printing out in the console but I receive a weird looking result instead

"""Here is some text
...
...
... With some space between !"""
'Here is some text \n\n\nWith some space between !'

As you can see I receive some \n\n\n instead of the actual space !

2 Answers

Christopher Shaw
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Shaw
Python Web Development Techdegree Graduate 58,248 Points

The \n is the new line string character. So instead of the console if you assign the input to a variable:

text = """some text


last line"""

see the difference between unformatted

text

and formatted

print(text)

I got it, if you code below to your console, it won't show \n any more print(text)

if you only type text, it will have \n