我是python的新手,我收到了上面列出的错误
@app.route('/AddNewInfo', methods = ['GET', 'POST'])
def AddNewInfo():
if request.method == 'POST':
name = request.form['name']
email = request.form['email']
submit = request.form['submit']
if submit:
with open("info.txt", "w") as text_file:
text_file.write((name, email))
return render_template('show_info.html',name=name, email=email)
else:
return render_template('AddNewInfo.html')
HTML:
<html>
<head>
<title>Add new information</title>
</head>
<body>
<h1>Enter New Info</h1>
<form action="" method="post">
Name: <input type="text" name="name"><br />
Email: <input type="text" name="email"><br />
<input type="submit" value="Submit">
</form>
</body>
</html>
如果request.method ==&#39; POST&#39;如果它只返回AddNewInfo
,它的工作方式固定 有一个帖子请求而不是我的index.html