title: Parse html form into a list of dicts in python / Flask
body: <p>I am new to web programming and this is my first SO question, so hopefully I am asking the right way. I am building a simple survey-maker (similar to google forms or survey monkey) and I have a web form that allows the user to add options to a question. Each option has two fields, 'label' and 'value'. The form looks like this:</p>
  
  <pre><code>    Option One
             ------------------           ------------------
      Label: |                |   Value:  |                |
             ------------------           ------------------
  
      Option Two
             ------------------           ------------------
      Label: |                |   Value:  |                |
             ------------------           ------------------
      ...
      ...
      ... // user can "add option" and additional "rows" will appear in the form
  
  [ SUBMIT ]
  </code></pre>
  
  <p>I have used a basic web form like this:</p>
  
  <pre><code>&lt;form class="well form" action="/submitform" method="post"&gt;
    &lt;p&gt;&lt;input type="text" name="label_1"&gt;
       &lt;input type="text" name="value_1"&gt;&lt;/p&gt;
    &lt;p&gt;&lt;input type="text" name="label_2"&gt;
       &lt;input type="text" name="value_2"&gt;&lt;/br&gt;&lt;/p&gt;
    &lt;p&gt;...   // and so forth, to support n sets of two fields
       ...
       ...
    &lt;button type="submit"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>I successfully get request.form and can access each variable in the dict. But of course it's a single flat dict:</p>
  
  <pre><code>[{'label_1': 'labelone', 'value1': 'valueone', 'label_2': 'label two'}]
  </code></pre>
  
  <p>and so forth. I want a list of dicts like this:</p>
  
  <pre><code>[ {'label': 'labelone', 'value': 'valueone'}, {'label': 'labeltwo', 'value': 'valuetwo'}]
  </code></pre>
  
  <p>I've thought of several hackish ways to do this, but all require foreknowledge of the number and type of form options. I'd rather find a more flexible solution.</p>
  
  <p>Any best practice here? A lot of sites do things like this so I'm guessing there's a best practice that I'm missing.</p>