Answers for "checking substring in python and count"

0

python substring count

def count_substring(string, sub_string):
    c = 0
    while sub_string in string:
        c += 1           
        string = string[string.find(sub_string)+1:]
    return c
Posted by: Guest on April-07-2021
0

how to count substring in a string in python

count = string.count(substring)
Posted by: Guest on March-18-2021

Code answers related to "checking substring in python and count"

Python Answers by Framework

Browse Popular Code Answers by Language