Python - Multi line string


Python allows strings to be enclosed in single or double quote characters.

They mean the same thing but allow the other type of quote to be embedded with an escape.

Python allows multiline string literals enclosed in triple quotes.

When triple quotes is used, all the lines are concatenated together, and end-of-line characters are added where line breaks appear.

It is useful for embedding things like multiline HTML, XML, or JSON code in a Python script:


msg = """ 
this is a test#   ww  w .  ja  v a2s . c  om
print( msg )


Related Topic