count same string in list python 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 occurrences of value in array python
>>> l = ["a","b","b"]
>>> l.count("a")
dict((i, a.count(i)) for i in a)
>>> l = ["a","b","b"]
>>> l.count("a")