当前位置:首页 > python代码库 > 字符串操作 > 使用字符串模板

使用字符串模板

点击次数:1035  更新日期:2018-09-28
from string import Template

temp=Template("select ${field} from ${table}")
text=temp.substitute(field="*",table="test")
print(text)