1. Template对象构造
Template对象有7种构造方法, 分别如下:
- * 直接使用字符串
t = Template("The king is a $placeholder1.")
Pass the template definition as a string.
- * 使用模板文件
t = Template(file="fink.tmpl")
Read the template definition from a file named "fink.tmpl".
- *使用文件对象
t = Template(file=f)
Read the template definition from file-like object 'f'.
- *重载方法,加入填入信息
t = Template("The king is a $placeholder1.", searchList=[dict, obj])
t = Template(file="fink.txt", searchList=[dict, obj])
t = Template(file=f, searchList=[dict, obj])
posted on 2008-06-25 17:45
JustRun 阅读(327)
评论(0) 编辑 收藏 所属分类:
Cheetah