how to use counter on dictonary values are list items
<p>My defaultdict is as follows:</p>

<pre><code>defaultdict(&lt;class 'list'&gt;, {'DrJillStein': [18021496, 30576467, 35175054, 122130797, 227720229, 289019104, 441389311, 456794981, 774180818,763849988988211200], 'realDonaldTrump': [14669951, 22203756, 41634520, 50769180, 75541946, 245963716, 475802156, 2325495378, 720293443260456960, 729676086632656900], 'GovGaryJohnson': [15232635, 19089116, 22330739, 29255194, 44776017, 47490022, 51752944, 73206956, 90573676, 366743017], 'HillaryClinton': [15972271, 34782406, 113298560, 115740215, 325886383, 582037089, 802430450, 3044781131, 729761993461248000, 734768872625188864]})
</code></pre>

<p>It contains <code>use_name</code> and then a list of ids, in short -> key = user and value = list of ids.</p>

<p>I wanted first to find out common ids and then to find out the most 5 common ids in all dict, like:
if 
    id =14669951, 15513604, 22203756</p>

<p>then there occurrences like:</p>

<pre><code>{[14669951:2][15513604:4][22203756:7]}
</code></pre>

<p>Guide me how to do that on python 3.5 or on greater version.</p>

<p>Initialize a <code>Counter</code> from <code>collections</code> and ask for the 5 <code>most_common</code>.</p>

<p>In order to initialize the <code>Counter</code> just provide it with a comprehension:</p>

<pre><code>c = Counter(v for sub in d.values() for v in sub)
</code></pre>

<p>I added an extra <code>id</code> to your <code>defaultdict</code> to get a count of <code>2</code> for one of them. The result can be obtained with <code>c.most_common(5)</code>:</p>

<pre><code>c.most_common(5)
[(14669951, 2),
 (720293443260456960, 1),
 (763849988988211200, 1),
 (366743017, 1),
 (245963716, 1)]
</code></pre>

python list python-3.x dictionary counter