Find a string

  • + 0 comments
    def count_substring(string, sub_string):
        sub_len=len(sub_string)
        c=0
        for i in range(len(string)):
            if string[i :i+sub_len]==sub_string:
                c +=1
        return c