i have following html with n groups of input:
<form action="{{ url_for('list_names') }}" method="POST">
<label>Name</label>
<input name="peson_name" type="text">
<label>Age</label>
<input name="person_age" type="number">
<label>Name</label>
<input name="peson_name" type="text">
<label>Age</label>
<input name="person_age" type="number">
</form>
i would like to iterate thru every input and pass them to python function using flask and create list of dictionaries
@app.route('/list_names', methods=["GET", "POST"])
def list_names():
if request.method == 'POST':
and this is where I stuck. the output that i'm looking for is a list of dictionaries that should ideally looks like this:
[
{
'name': 'person1',
'age': 25
},
{
'name': 'person2',
'age': 30
}
]