Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python .format

Name = 'Tame Tamir'
Age = 14

Formatted_string = 'Hello, my name is {name}, I am {age} years old.'.format(name=Name,age=Age)
# after the formatting, the variable name inside the {} will be replaced by whatever you declare in the .format() part.
print(Formatted_string) # output = Hello, my name is Tame Tamir, I am 14 years old.
Comment

.format python 3

#New Style
'{} {}'.format('one', 'two')

#Old Style
'%s %s' % ('one', 'two')
Comment

PREVIOUS NEXT
Code Example
Python :: plt delete space before axis 
Python :: numpy array deepcopy 
Python :: r char to numeric dataframe all columns 
Python :: django abstractuser 
Python :: download unsplash images 
Python :: print list in one line python 
Python :: return mean of df as dataframe 
Python :: python integer to octal 
Python :: divide all values in array python 
Python :: python get line of exception 
Python :: netcdf in python 
Python :: axios django post 
Python :: update all pip packages 
Python :: python beautifulsoup get option tag value 
Python :: python list contains 
Python :: comtypes python 
Python :: how to access items in a list 
Python :: how to check a string is empty in python 
Python :: soustraire deux listes python 
Python :: python enumerate 
Python :: python tuple and dictionary 
Python :: python tkinter checkbox default value 
Python :: How to install a python packagae 
Python :: simple seaborn heatmap 
Python :: python sort descending 
Python :: python string to operator 
Python :: fernet in python 
Python :: what are test cases in python 
Python :: removing duplicates from django models data 
Python :: head first python by paul barry pdf 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =