multiline string python code example

Example 1: python multiline string

#you can start a multiline string with either ''' or """
'''This is a 
multiline 
string.'''

"""It can be used as a
multiline comment 
too."""

Example 2: format multi line string python

# String containing newline characters
line_str = "I'm learning Python.\nI refer to TechBeamers.com tutorials.\nIt is the most popular site for Python programmers."
print("Long string with newlines: \n" + line_str)

# Creating a multiline string
multiline_str = """I'm learning Python.
I refer to TechBeamers.com tutorials.
It is the most popular site for Python programmers."""
print("Multiline string: \n" + multiline_str)

Example 3: python multILINE string

"""You can
use both 
double quotes
"""
'''And
singel
quotes
'''
# in a normal string this will be displayed as
# And\nsingel\nquotes\n