Answers for "find number of times a string occurs as a substringin given string"

1

check how many times a substring appears in a string

a = '128532012'
print(a.count('0'))
#Prints: 1

print(a.count('12'))
#Prints: 2
Posted by: Guest on December-04-2020

Code answers related to "find number of times a string occurs as a substringin given string"

Python Answers by Framework

Browse Popular Code Answers by Language