-2
如何获得这些变量。 这可能很容易,但我今天不认为。变量访问,获取和发布
class Contact(webapp.RequestHandler):
def get(self):
self.a = random.randint(1,4)
self.b = random.randint(0,4)
template_values = {
'a': self.a,
'b': self.b
}
path = os.path.join(os.path.dirname(__file__), 'contact.html')
self.response.out.write(template.render(path, template_values))
def post(self):
self.response.out.write(self.a)
self.response.out.write(self.b)
引用:
Traceback (most recent call last):
File "C:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 702, in __call__
handler.post(*groups)
File "D:\My Dropbox\project\main.py", line 133, in post
self.response.out.write(self.a)
AttributeError: 'Contact' object has no attribute 'a'
错误发生在哪里?在'后'?你在这里试图做什么? –
是的在后,简单的数学验证码 –
我们喜欢看到完整的回溯。 –