message = 'python is popular programming language'
# number of occurrence of 'p'
print('Number of occurrence of p:', message.count('p'))
>>> Number of occurrence of p: 4
string.count(substring, start=..., end=...)
'recede'.count('e')
>>> 3
'recede'.count('e', 2, 4)
>>> 1
# Count method in strings. it returns number of occurance of the substring
# in the given string
string.count(substring, start=..., end=...)
# Python program to demonstrate the use of
# count() method without optional parameters
# string in which occurrence will be checked
string = "Hello Welcome to Softhunt.net We Welcome you"
# counts the number of times substring occurs in
# the given string and returns an integer
print(string.count("Welcome"))