隨筆-6  評論-0  文章-0  trackbacks-0
          1. Template對象構(gòu)造

          Template對象有7種構(gòu)造方法, 分別如下:
          * 直接使用字符串
          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 閱讀(340) 評論(0)  編輯  收藏 所屬分類: Cheetah
          主站蜘蛛池模板: 贺兰县| 石城县| 庄浪县| 新干县| 安仁县| 南汇区| 博罗县| 丘北县| 宣化县| 肥西县| 大悟县| 恩平市| 四平市| 镇江市| 岐山县| 彭山县| 柳州市| 公安县| 浦江县| 北票市| 华坪县| 晋江市| 乐亭县| 晴隆县| 德安县| 奇台县| 彭泽县| 海林市| 柳江县| 东辽县| 龙口市| 和政县| 文安县| 浏阳市| 芷江| 柳州市| 揭西县| 南和县| 繁昌县| 义乌市| 南京市|