Skip to main content

Combine Dictionaries

 #combine dict

dict1 = {'BH': ['apple1', 'banana1'], 'FB': ['orange1', 'grapes1']}

dict2 = {'BH': ['apple2', 'banana2'], 'FB': ['orange2', 'grapes2']}


dict3 = {}


for k in dict1.keys():

    dict3[k] = ['one/' + itm for itm in dict1[k]] + ['two/' + itm for itm in dict1[k]]


print(dict3)