Multi-line strings ("""…""")
A string between triple quotes can span several lines, and the line breaks stay inside the text.
Used in 109 lessons of the course, from 00.01.
A normal string lives on one line. If you open it with """ and close it with """, Python keeps everything in between as it is: line breaks, spaces, and single or double quotes.
This means indentation inside the string is part of the text too. That is why you write it flush to the margin when it matters.
You can also use ''', which works the same way.
In the course you mostly see it as a docstring: the first text inside a function, like """Print the definition of term...""". There it explains what the function does. It also fits long prompts, where one multi-line string is easier to read than many \n.
texto = """uno
dos"""
Reach for it when: the text spans several lines, like a docstring or a long prompt, or when it contains quotes you don't want to escape.
Examples
Common mistake
texto = """
hola
"""
print(repr(texto))Why: The leading line break, the indentation spaces and the final line break are part of the string, even if you don't notice them while typing.
How to write it: Write the text right against the quotes or clean the result with .strip().
