摘要:
摘自:python参考手册.string模块定义了一种新字符串类型Template,简化了特定的字符串置换操作,Template定义一个类1.template(s), #s是字符串s='hello,$world!' #template 的置换符属性delimiter 默认是$,2.t=template(s) #定义template的对象template的对象t支持的方法 3.t.substitute(m,[,**kwargs]) #其中m是一个字典(或一个关键字参数列表),会对字符串s进行关键字置换,t.substitute({'world':'nime 阅读全文