Summing multiple values of each key in a dict?
<p>I have a python dictionary, which  looks like this.</p>

<pre><code>{ 'item1' : [1,2,3,4,5,6],
  'item2' : [2,3,1],
   .
   .
   .
  'item n' : [4,2,4,3,2]
}
</code></pre>

<p>Now my requirement is that i want to add the numeric values of this dict &amp; to show it as :-</p>

<pre><code>{    'item1' : [21],
     'item2' : [6],
      .
      .
      .
     'item n' : [15]
}
</code></pre>

<p>I just want the multiple values of each key to be summed up &amp; displayed. FYI, I am using an append function. Below is my code.</p>

<pre><code>for row in range(2,sheet2.max_row):
    for column in "D": 
        cell_name = "{}{}".format(column, row)
    for column2 in "P":
        cell_name2 = "{}{}".format(column2,row)
        arrdata2dict.setdefault(sheet2[cell_name].value,[])
        arrdata2dict[sheet2[cell_name].value].append(sheet2[cell_name2].value)
</code></pre>