python multiline string with variables 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: 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

Example 3: python variables in multiline string

toname = "Peter"
toemail = "p@tr"
subject = "Hi"
content = f"""From: Fromname <fromemail>
    To: {toname} <{toemail}>
    MIME-Version: 1.0
    Content-type: text/html
    Subject: {subject}

    This is an e-mail message to be sent in HTML format

    <b>This is HTML message.</b>
    <h1>This is headline.</h1>
"""