Answer the question
In order to leave comments, you need to log in
Array of form data in python (Pyramid)
Hello.
Tell me how to get an analogue of the following in python:
HTML
<input type="text" name="someinput[]" value="1" />
<input type="text" name="someinput[]" value="2" />
<input type="text" name="someinput[]" value="3" />
$_POST['someinput'] - массив (1, 2, 3)
Answer the question
In order to leave comments, you need to log in
RTFM: Request -> MultiDict
request.POST.getall('foobar') - will return all values named foobar
And according to what law, these parameters should be aggregated into an array? This behavior is solely the lot of PHP and / or libraries involved in the processing of url parameters, nothing more.
request.POST is a MultiDict,
you can get all values by key like this request.POST.getall('someinput[]')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question