Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to count the occurrence of a word in string python

# define string
string = "Python is awesome, isn't it?"
substring = "is"

count = string.count(substring)

# print count
print("The count is:", count)
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #count #occurrence #word #string #python
ADD COMMENT
Topic
Name
4+4 =