擅长:python、mysql、java
<p>您可以利用来自<code>collections</code>的<code>Counter</code></p>
<p>例如</p>
<pre><code>>>> from collections import Counter
>>> l = [595, 595, 344, 344, 628, 628, 628, 353, 353, 353, 353, 353]
>>> new_dict=Counter(l)
>>> new_dict
Counter({353: 5, 628: 3, 595: 2, 344: 2})
>>> [key for key, val in new_dict.items() if val == 2]
[595, 344]
</code></pre>