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))



Output


Picture showing how the string is formatted in python



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

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250