Articles → Python → String formatting in python

String formatting in python






Syntax




“string %s“ % (variable_name) # string
or
“string %d“ % (variable_name) # integer



Example


print ("My Name is %s and my age is %d" % ("Karan",35))





Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Monday, February 11, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250