首页 > 编程语言 > 详细

python 字符串模板

时间:2019-05-03 14:43:15      阅读:135      评论:0      收藏:0      [点我收藏+]

 

from string import Template
print(type(Template))
mystr = Template("hi,$name 你是$baby")
print(mystr.substitute(name = "边真", baby = "lovely "))

输出

# 结果
<class string._TemplateMetaclass>
hi,边真 你是lovely 

 

python 字符串模板

原文:https://www.cnblogs.com/sea-stream/p/10805120.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!