语法错误CGI scrip

2024-04-16 08:40:02 发布

您现在位置:Python中文网/ 问答频道 /正文

name = form.getvalue('name')

age = form.getvalue('age') + 1
next_age1 = int(form["age"].value

print "Content-type: text/html"
print
print "<html><head>"
print "<p> Hello, %s</p>" % (name)
print "<p> Next year, you will be %s years old.</p>" % next_age1

很难理解为什么这不起作用。在

有人能帮帮我吗?在

谢谢你!在


Tags: textnameformhelloagevaluehtmltype
1条回答
网友
1楼 · 发布于 2024-04-16 08:40:02

缺少右括号:

 next_age1 = int(form["age"].value
 #            ^             -^ nothing here

经验法则:当你遇到一个语法错误时,你不能马上在那一行找到,看看前一行是否正确地平衡了括号和大括号。在

相关问题 更多 >