How to count the occurrences of a given substring from part of a string in Python

1 Answer

0 votes
string = "php python java c python c++ python"
substring = "python"

count = string.count(substring, 3, 24)
print( count)



'''
run:

2

'''

 



answered Dec 10, 2019 by avibootz

Related questions

...