In Python, we have a function str.count() which tells the number of count of any character in a string:-
str.count(sub[, start[, end]]):-
It returns the number of non-overlapping occurrences of substring sub in the range [start, end]. Optional arguments start and end are interpreted as in slice notation.
Below is an example that shows you how it works:-
sentence = 'Mary had a little lamb'