title: Python, how to merge three dictionary in one filtering for key?
body: <p>I have the following dictionaries:</p>
  <pre><code>personale_dip={'a': [550.0], 'b': [157.65]}
  personale_dip_costo={'a': [1.0], 'b': [150.0]}
  personale_result={'a': 550.0, 'b': 23648.64}
  </code></pre>
  <p><code>Personale_result</code> has been obtained with the following code:</p>
  <pre><code>personale_result={k : v[0] * personale_dip_costo[k][0] for k, v in personale_dip.items() if k in personale_dip_costo}
  </code></pre>
  <p>I want to create a new variable, called <code>final_value</code> that, that for each key (matching them across dictionary) summarize all three dictionary giving me the following result:</p>
  <pre><code>final_value={'a': [550.0, 1.0, 550.0],   'b': [157.65, 150.0, 23648.64]}
  </code></pre>
  <p>How should I do it? Any help would be much appreciated. Thanks in advance!</p>
  <p><strong>EDIT</strong></p>
  <p>I have tried the following code:</p>
  <pre><code>from collections import defaultdict
  
  personale_dip = {'a': [550.0], 'b': [157.65]}
  personale_dip_costo = {'a': [1.0], 'b': [150.0]}
  personale_result = {'a': 550.0, 'b': 23648.64}
  
  data = defaultdict(list)
  
  for d in [personale_dip, personale_dip_costo, personale_result]:
      for k, v in d.items():
          if isinstance(v, list):
              data[k].extend(v)
          else:
              data[k].append(v)
  
  </code></pre>
  <p>but the result is</p>
  <pre><code>defaultdict(&lt;class 'list'&gt;, {'a': [550.0, 1.0, 550.0], 'b': [157.65, 150.0, 23648.64]}) 
  </code></pre>
  <p>If I want to obtain only</p>
  <pre><code>{'a': [550.0, 1.0, 550.0], 'b': [157.65, 150.0, 23648.64]}
  </code></pre>
  <p>How could I get it?</p>