The count() is a built-in function in Python that returns you the count of a given element in a  list or a string.

Python String count()

Python string count() is an inbuilt function that returns the number of occurrences of the substring in the given string. The count() method searches the substring in the given string and returns how many times the substring is present in it. It also takes optional parameters to start and end to specify the starting and ending positions in the string respectively.

Syntax

See the following syntax.

string.count(substring, start, end)

#python #python string count

Python String Count: How to Count Substrings in Python
2.10 GEEK