collections.Counter function
import collections
data = [10, 'test', 'test', 10, 'Hi', 'test']
result = dict(collections.Counter(data))
print(result)
import collections
data = [10, 'test', 'test', 10, 'Hi', 'test']
result = dict(collections.Counter(data))
print(result)
Leave a Comment
Cancel reply