I need to combine two lists with dictionaries in them:
dict1 = [{'Count': '307', 'name': 'Other', 'Percentage': '7.7%'}, {'Count': '7,813', 'name': 'Other', 'Percentage': '6.8%'}...]
dict2 = [{'Place': 'Home'}, {'Place':'Forest'},...]
The first list contains 56 elements (56 dictionaries) and 14 elements in the second list (dict2). What I want to do is insert the first element from dict2 into the first four elements of dict 1 and repeat the process until all 56 elements in dict1 have {Place: x}.
So, in the end, I want to get:
newdict = [{'Count': '307', 'name': 'Other', 'Percentage': '7.7%', 'Place': 'Home'}, {'Count': '7,813', 'name': 'Other', 'Percentage': '6.8%', 'Place':'Home'},{'Name': 'Other', 'Percentage': '6.6%', 'Place': 'Home', 'Count': '1,960'},{'Name': 'Other', 'Percentage': '7.6%', 'Place': 'Home', 'Count': '1,090'},{'Name': 'Other', 'Percentage': '7.6%', 'Place': 'Forest', 'Count': '1,090'} ]
etc.
When dict2exhausted, it should start from the first element again.
So, I updated the question. My first task for this problem was to increase the number of identical keys: the values in dict2: dict2 = [{'Place': 'Home'}, {'Place':'Home'},{'Place':'Home'},{'Place':'Home'},{'Place':'Forest'},{'Place':'Forest'}...]
and then use the same method mentioned below to combine the dictionaries. But I believe that there should be a way to do this without changing dict2.