python - How to submit a flask form to a list? -


this question has answer here:

i new python. have flask form submitting. when submit form trying post data list follows:

submittedwords=[] v in request.form.items():     submittedwords.append(v) 

this give mt following:

[('w1', 'first'), ('w2', 'second'), ('w5', 'third'), ('w7', 'fourth'), ('w4', ''), ('w6', ''), ('w3', '')] 

where w1,w2,w3.... input name , first,second,third... data entered/submitted.

is tuples inside list?

is there way output 'data' section such as

['first','second','third','fourth','','',''] 

thanks in advance!

that's items does; iterates through dictionary in form of (key, value) pairs.

if want values, iterate through those:

for v in request.form.values(): 

Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -