Understanding and usage of "%s"% in python

"% S"% a format string of grammar, the basic usage value is inserted into the string% s placeholders.
E.g:

x = "my"
print("you are %s love"%x)

Insert picture description here
It can be found that %s implements the insertion of x into the string.

def detail1(name,age):
    print("Her name is %s."%name)
    print("She is %s years old."%age)
    
object1 = detail1('caroline',19)

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_45154565/article/details/109350644