I have two dicts:
dict1={"test":345,"testing":123,"reality":2,"factor":5,"user":1}
dict2={"newone":123,"test":4,"reality":"4","edu":2}
Now,I want to form a new dictionary as follows:
dict3={"test":[345,4],"testing":[123,0],
"reality":[2,4],"factor":[5,0],"user":[1,0],"newone":[0,123],"edu":[0,2]}
I want to add 0 if any key is not present in dict1 at the first index and add 0 if any key is not present in dict2. How can I achieve this? I have tried the following code:
for keys1,values1,keys2,values2 in zip(dict1.items(),dict2.items()):
if keys1 not in dict2.keys():
dict2.keys().append(0)
elif keys2 not in dict1.keys():
dict1.keys().append(0)
else:
pass