Mike P michael.pearmain at tangozebra.com
Tue Sep 2 17:04:51 CEST 2008

Hi All,

I have two dictionaries e.g
dict1 = {123:3,234:5,456:3}
dict2 = {123:4,157:2,234:5,456:3,567:2}

I want to merge these two dictionaries together so i have a resultant
dictionary of:

dict3 = {123:[4,3],157:[2,0],234:[5,5],456:[3,3],567:[2,0]}

As later on i want to write a csv file that would have the form

id      var1  var2
123     4      3
157     2      0

i looks like the dict.update looks almost there but i can't get it to
work properly, can anyone offer any advise?

More information about the Python-list mailing list