python list count string code example
Example 1: how to find the number of times a number appears in python
dict((i, a.count(i)) for i in a)
Example 2: count values in list usiing counter
from collections import Counter
dict((i, a.count(i)) for i in a)
from collections import Counter