Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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."""
Comment

assign multiline string to variable in python

a = """This is python progrmming
python is simple and easy to use"""
print(a)
Comment

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>
"""
Comment

python multILINE string

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

python multiline string with parameters

cmd = f"""line {1}
      line {2}
      line {3}"""
Comment

PREVIOUS NEXT
Code Example
Python :: python how to get the folder name of a file 
Python :: python convert a list to dict 
Python :: install opencv for python 2.7 
Python :: python exam questions pdf 
Python :: python program to find largest number in a list 
Python :: first and last digit codechef solution 
Python :: binary, decimal, hex conversion python 
Python :: python numpy array size of n 
Python :: install different python version debian 
Python :: python string vs byte string 
Python :: how to remove quotes from a string in python 
Python :: initialise a 2d array python 
Python :: dictionary indexing python 
Python :: view all columns in pandas dataframe 
Python :: how to use cv2.COLOR_BGR2GRAY 
Python :: django timezone settings 
Python :: random.choice 
Python :: alpha beta pruning python code 
Python :: virtualenv specify python version 
Python :: make a list in python 3 
Python :: pathlib remove extension 
Python :: breadth first search graph python 
Python :: sum first 100 integers in python 
Python :: suppress python 
Python :: word guessing game python 
Python :: how to make a list a string 
Python :: python extract zip file 
Python :: python b before string 
Python :: matplotlib orange line 
Python :: python getters and setters 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =