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

php - trouble displaying mysqli database results in correct order -

depending on nth recurrence of job in control M -

sql server - Cannot query correctly (MSSQL - PHP - JSON) -