str count python 1

str count python

string.count(substring, start=..., end=...)

'recede'.count('e')
>>> 3
'recede'.count('e', 2, 4)
>>> 1

Here is what the above code is Doing:
1. The first line is a comment.
2. The second line is a function definition.
3. The third line is a function call.
4. The fourth line is a comment.
5. The fifth line is a function call.
6. The sixth line is a comment.

Similar Posts