立即学习:https://edu.csdn.net/course/play/26755/340104?utm_source=blogtoedu
有多少字符串格式化的方法:
1.%
2.模板字符串
3.formt函数
如何使用模板字符串:
from string import Template
text = Template("I love my $s. My $s loves me,too.")
print(text.substitute(s = "father"))
"""结果:
I love my father. My father loves me,too. """