PyDocs

Nav

Python Runtime Services

str.count

builtins

method of str
  • str.count(sub[, start[, end]])
Return the number of non-overlapping occurrences of substring sub in string S[start:end].

Optional arguments start and end are interpreted as in slice
notation.
1 Example
>>> 'spam, spam, spam'.count('spam')
3
>>> 'spam, spam, spam'.count('spam', 5)
2
>>> 'spam, spam, spam'.count('spam', 5, 10)
1
>>> 'spam, spam, spam'.count('eggs')
0
>>> 'spam, spam, spam'.count('')
17
from the Python docs
See Also
No see-alsos for builtins/str.count
0 Notes
No notes for str.count