Answers for "count of a substring in a string python"

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

Code answers related to "count of a substring in a string python"

Python Answers by Framework

Browse Popular Code Answers by Language