adding lists with containers
<p>How can I accomplish this in Python?
<a href="http://stackoverflow.com/questions/7875995/combining-lists-of-word-frequency-data">Combining Lists of Word Frequency Data</a></p>

<p>Let's say I have two lists A and B and both contain the words&amp; frequencies of a file in descending frequency order, how can I do what's done in the question in Python?</p>

<pre><code>from FrequentWords import *
from WordFrequencies import * # makes the list with words&amp;frequencies 
L = WordFrequencies('file.txt')
words1 = L[0]
freqs1 = L[1]
L1 = computeWordFrequencies('file1.txt')
words2 = L1[0]
freqs2 = L1[1]
words = zip(*sorted(zip(L,L1)))
both1 = sorted(freqs1+freqs2,reverse=True)
common_words = set(words1) &amp; set(words2)
frequency_common_words = both1
</code></pre>
