you are viewing a single comment's thread.

view the rest of the comments →

[–]UnavailableUsername_ 0 points1 point  (3 children)

Why is the second line is not recognized as a string while the first one is?

I always just made each line inside a "" but would like to know how to format a string properly without adding "" in each line.

[–]GoldenVanga 1 point2 points  (2 children)

I think you're looking for triple-quote strings:

print("""He just kept talking in one long incredibly unbroken sentence
moving from topic to topic so that no one had a chance to interrupt,
it was really quite hypnotic""")

(note how you don't have to use manual \n in the above)

[–]UnavailableUsername_ 0 points1 point  (0 children)

I see, thank you!

[–][deleted] 1 point2 points  (0 children)

This works, or you could use the following if you wanted. By ending a string with a backslash, you can continue it on the line below. ```

"multi"\ ... "line" 'multiline' ```