Skip to main content

str.count()

str.count(value)

Returns the number of times a specified value appears in the string.

Input:
value : String
The string to value to search for.
Returns:
The number of times value appears in str.
Return Type:
int

"I like potato, wanna mash my potato, won't you mash your potato with me?".count("potato")

3


Problems or suggestions about this page? Fill out our feedback form.