python flask ImmutableMultiDict
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/23205577/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
python flask ImmutableMultiDict
提问by Matteo
This is my code:
这是我的代码:
@user_bp.route('/band', methods=['GET', 'POST'])
def band_details():
from include.form.User import Banddetails
form = Banddetails()
if request.method == 'POST' and form.validate_on_submit():
pippo = request.args.getlist('name[]')
print 'sei passato di qui' + str(len(pippo))
for item in pippo:
print item
return "result"
return render_template("banddetails.html", form=form, session=session)
I have a similar form:
我有一个类似的表格:
<input type="text" name="name[]" id="name" value="">
I want get the element name[]
, lastname[]
, ... but I don't understand the procedure described in the flask api.
我想获取元素name[]
, lastname[]
, ... 但我不明白烧瓶 api 中描述的过程。
采纳答案by kartheek
回答by Matthew Russell
you can also do the following:
您还可以执行以下操作:
d = request.form.to_dict()
source: https://tedboy.github.io/flask/generated/generated/werkzeug.ImmutableMultiDict.html
来源:https: //tedboy.github.io/flask/generated/generated/werkzeug.ImmutableMultiDict.html