Python Program - Create a Long Multiline String

To create a long multiline string in Python, you can use triple quotes (""" or ''') to start and end the string. This allows you to include multiple lines of text without having to use the newline character (\n) after each line. Here's an example:

long_string = """
This is a long
multiline string
that spans multiple lines.
"""

print(long_string)
Source:‮ww‬w.theitroad.com

Output:

This is a long
multiline string
that spans multiple lines.

You can also use the + operator to concatenate multiple strings together, like this:

long_string = "This is a long " + \
              "multiline string " + \
              "that spans multiple lines."

print(long_string)

Output:

This is a long multiline string that spans multiple lines.

Note the use of the backslash (\) at the end of each line to continue the string on the next line.