【发布时间】:2015-06-21 15:11:53
【问题描述】:
我想将三个不同的变量传递到我使用 Web.py 的 html 模板中。
这是我所拥有的:
class mainScreen:
def __init__(self):
self.render=web.template.render('templates/')
def GET(self):
return self.render.firstScreen(variable1, variable2, variable3)
def POST(self):
pass
在我的 html 模板中:
$def with (variable1)
$def with (variable2)
$def with (variable3)
<!DOCTYPE html>
<html>
<head>
<title>variable1</title>
</head>
<body>
$variable2
<h1>$variable3</h1>
</body>
</html>
但是,在我的 html 模板中,我在使用三个变量中的每一个定义的顶部遇到了一个语法错误。如何正确传入三个变量?
【问题讨论】: