Multiline string literal

Basic types / Strings

from textwrap import dedent

# Triple quotes keep the line breaks and the indent
multiline_string = """
    1. First line
    2. Second \
    line
        3. Third line
    4. Fourth "line"
    """

print(f"{multiline_string = }")

# dedent cuts the common indent, \ skips the first line break
trimmed = dedent("""\
    1. First line
    2. Second line
        3. Third line
    4. Fourth "line"
    """)

print(f"{trimmed = }")

# Adjacent literals join into one string
joined = ("1. First line\n"
          "2. Second line")

print(f"{joined = }")