bunch

How to convert a list of dictionaries to a Bunch object

How to convert a list of dictionaries to a Bunch object Question: I have a list of the following dictionaries: [{‘Key’: ‘tag-key-0’, ‘Value’: ‘value-0’}, {‘Key’: ‘tag-key-1’, ‘Value’: ‘value-1’}, {‘Key’: ‘tag-key-2’, ‘Value’: ‘value-2’}, {‘Key’: ‘tag-key-3’, ‘Value’: ‘value-3’}, {‘Key’: ‘tag-key-4’, ‘Value’: ‘value-4′}] Is there an elegant way to convert it to a Bunch object? Bunch(tag-key-0=’value-0′, tag-key-1=’value-1′, tag-key-2=’value-2’, …

Total answers: 3