Elegant way to rearrange dictionary on number in key string
<p>Say I have a dict with these objects:</p>

<pre><code>&lt; MultiValueDict: {
        u 'task-1-t_name': [u 'T2'],
        u 'task-INITIAL_FORMS': [u '0'],
        u 'task-1-end_date': [u '1010-01-01'],
        u 'task-MAX_NUM_FORMS': [u '1000'],
        u 'order_wizard-current_step': [u 'task'],
        u 'task-TOTAL_FORMS': [u '2'],
        u 'task-1-start_date': [u '1010-01-01'],
        u 'task-0-t_name': [u 'T1'],
        u 'task-MIN_NUM_FORMS': [u '0'],
        u 'task-0-end_date': [u '1010-01-01'],
        u 'task-0-start_date': [u '1010-10-01']
</code></pre>

<p>What would be the most pythonic and elegant way to create an array or dictionary that would give me <code>task[0].start_time</code> or <code>task[n]['key_name']</code></p>

<p>I feel like I am going to write a lot more code than necessary to do this</p>

<p>This is the data for a Django formset. Rather than trying to manipulate it separately, you should use the methods available on the formset itself: once you have validated that formset, you can do <code>formset.forms[0].cleaned_data['start_time']</code> for example.</p>

python arrays