Python
13
Вклад в тег
from collections import Counter
my_list = [10, 10, 23, 10, 123, 66, 78, 123]
c = Counter(my_list)
>>> c
Counter({10: 3, 123: 2, 66: 1, 78: 1, 23: 1})
>>> type(c)
<class 'collections.Counter'>
d = dict(c)
>>> d
{10: 3, 123: 2, 66: 1, 78: 1, 23: 1}
>>> type(d)
<class 'dict'>