Articles → Python → Format function in python

Format function in python






Purpose





Example




Name = “Karan”




print("My Name is ",name)




print("My Name is {}".format(name))




print("this is {} and another {}".format("placeholder1", "placeholder2"))





Click to Enlarge





print("this is {one} and another {two}".format(one = "placeholder1", two = "placeholder2"))





Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Tuesday, March 05, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250