dictionary values in python adding values
<p>So here is my problem, i have a dictionary with following key => values:</p>

<pre><code>6bc51fb21fd9eefef4ec97a241733cd59b71e8e14ad70e9068d32002:политичка -&gt; 2
6bc51fb21fd9eefef4ec97a241733cd59b71e8e14ad70e9068d32002:државата -&gt; 2
6bc51fb21fd9eefef4ec97a241733cd59b71e8e14ad70e9068d32002:енергично -&gt; 1
1caa60ebf9459d9cd406f1a03e1719b675dcfaad78292edc7e4a56be:полициска -&gt; 1
</code></pre>

<p>I have this code to show the keys needed:</p>

<pre><code>for key, value in count_db.iteritems():
        print key[:56]
</code></pre>

<p>So now i have:</p>

<pre><code>6bc51fb21fd9eefef4ec97a241733cd59b71e8e14ad70e9068d32002 -&gt; 2
6bc51fb21fd9eefef4ec97a241733cd59b71e8e14ad70e9068d32002 -&gt; 2
6bc51fb21fd9eefef4ec97a241733cd59b71e8e14ad70e9068d32002 -&gt; 1
1caa60ebf9459d9cd406f1a03e1719b675dcfaad78292edc7e4a56be -&gt; 1
</code></pre>

<p>I need to merge them into:</p>

<pre><code>6bc51fb21fd9eefef4ec97a241733cd59b71e8e14ad70e9068d32002 -&gt; 5
1caa60ebf9459d9cd406f1a03e1719b675dcfaad78292edc7e4a56be -&gt; 1
</code></pre>

<p>I have made this but i have not succeed in doing it correctly:</p>

<pre><code>length_dic=len(count_db.keys())
for key, value in count_db.iteritems():
    count_element=key[:56]
    #print "%s =&gt; %s" % (key[:56], value) #value[:56]

    for i in range(length_dic):
        i+=1
        if count_element == key[:56]:
            itr+=int(value) 
        print i
    length_dic=length_dic-1
</code></pre>

<p>Any hints?</p>
