我尝试使用Flask和python3.6构建一个简单的在线测试,使用带有单选按钮的HTML表单在Flask路径之间传送选定的答案。第一步是选择测验的类别,然后进入实际测验页面,如下所示:app = Flask(__name__)
categories = ['Europe', 'South America', 'North America']
@app.route('/')
def select():
return render_template('selecting.html', cats= categories)
@app.route('/quiz', methods = ['POST'])
def quizing():
selected_cat = request.form['categories']
return "
You have selected category: " + selected_cat + "
在哪里选择.html'如下所示:
^{pr2}$
当我选择“欧洲”时,测验页面显示:
You have selected category: Europe
但是,当我选择“北美”时,测试页面显示:
You have selected category: North
为什么所选类别的第二个单词没有出现在烧瓶路线之间?如何才能保留完整的类别名称?在