字符串模版(直觉是这个功能做WEB的时候很有用,可以轻易的实现根据模版生成静态页面的功能): from string import Template s = Template("There are ${test}") print s.substitute(test="python") ==>输出 There are python substitute中参数如果没有对应声明字符串模版中的 Template 对象还有另外一个方法save_substitute(),该方法在没有声明key的情况下不会报错,直接输出