import collections a_list = ["a", "b", "a"] occurrences = collections.Counter(a_list) print(occurrences)