擅长:python、mysql、java
<p>将3个列表与<code>itertools.chain</code>合并,然后使用<code>collections.Counter</code>对项目进行计数。你知道吗</p>
<pre><code>from collections import Counter
from itertools import chain
c = [['a', 'b', 'c', 'd'], ['a', 'b'], ['a']]
print(dict(Counter(chain(*c))))
</code></pre>
<p>这将输出:</p>
<pre><code>{'a': 3, 'b': 2, 'c': 1, 'd': 1}
</code></pre>