Python Tuple to Dict, with additional list of keys

Viewed 8208

So I have this array of tuples:

[(u'030944', u'20091123', 10, 30, 0), (u'030944', u'20100226', 10, 15, 0)]

And I have this list of field names:

['id', 'date', 'hour', 'minute', 'interval']

I would like to, in one fell swoop if possible, to convert the list of tuples to a dict:

[{
    'id': u'030944',
    'date': u'20091123',
    'hour': 10,
    'min': 30,
    'interval': 0,
},{
    'id': u'030944',
    'date': u'20100226',
    'hour': 10,
    'min': 15,
    'interval': 0,
}]
2 Answers
Related