a = [1,2,3,2,1,5,6,5,5,5]
import collections
print([item for item, count in (a).items() if count > 1])
输出
[1, 2, 5]
Pycharm warning:
This inspection reports discrepancies between declared parameters and actual arguments, as well as incorrect arguments and incorrect argument order.