【008】python の web.py教程学习
教程原文:http://webpy.org/docs/0.3/tutorial.zh-cn
第一个关于模版的简单实现
#-- code.py ---- import web render = web.template.render('templates/') urls = ('/(.*)','index') class index: def GET(self,name): return render.new(name)
# new 代表的是模版的名字 ; name 传递进去的参数
if __name__ == "__main__": app = web.application(urls,globals()) app.run()
# new.html $def with (name) $if name: I just wanted to say <em>hello</em> to $name. $else: <em>Hello</em>, world!