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', tag-key-3='value-3', tag-key-4='value-4')
My current solution is:
from bunch import Bunch
tags_dict = {}
for tag in actual_tags:
tags_dict[tag['Key']] = tag['Value']
Bunch.fromDict(tags_dict)