1、%占位符方法
>>> n1 = "i am %s age %d"%("tom",23)
>>> print(n1)
i am tom age 23
2、.format()方法
>>> f1 = "i am {}, i am {} years old".format('tom',21)
>>> print(f1)
i am tom, i am 21 years old
3、字符串前面加f
>>> name = 'tom'
>>> age = '23'
>>> s = f 'i am{name},age is {age}'
>>> print(s)
i amtom,age is 23