1.format() 字典方式
test = 'I am {name},age{a}'
#v = test.format(name = 'alex',a =19)
v = test.format(**{"name" : 'alex',"a":19})
print(v)
_____________________________
I am alex,age19
2.
test = 'I am {0},age{0}'
# v = test.format(name = 'alex',a =19)
#v = test.format(**{"name" : 'alex',"a":19})
v = test.format('alex',19)
print(v)
————————————
I am alex,age 19