Chinaunix首页 | 论坛 | 博客
  • 博客访问: 579378
  • 博文数量: 43
  • 博客积分: 10257
  • 博客等级: 上将
  • 技术积分: 480
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-06 02:16
文章分类

全部博文(43)

文章存档

2011年(5)

2010年(12)

2009年(6)

2008年(20)

分类: Python/Ruby

2011-04-06 17:18:19

python cgi:
 
  1. def showTemplate(self):
  2.     cLookup = TemplateLookup(directories=["../template"],
  3.               input_encoding="gbk",
  4.               output_encoding="utf-8")
  5.     cTemplate = Template(filename="../template/mytpl.html",
  6.                 input_encoding="gbk",
  7.                 output_encoding="utf-8",
  8.                 lookup=cLookup)
  9.     print cTemplate.render(data=self.data)
 
html template:
 
  1. <meta http-equiv=Content-Type content="text/html; charset=utf-8">
阅读(1888) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~