学习笔记(14):Python 面试100讲(基于Python3.x)-Python字符串格式化知多少

立即学习:https://edu.csdn.net/course/play/26755/340104?utm_source=blogtoedu

Template对象封装,$放置一些占位符,并通过substitute方法用实际的值替换这些占位符:

template1 =Template('$s是最好的语言)

print(template1.substitute(s='python')

发布了26 篇原创文章 · 获赞 2 · 访问量 283

猜你喜欢

转载自blog.csdn.net/qq_35504363/article/details/104284074