Find a string

  • + 0 comments

    easier version

    def count_substring(string, sub_string): counter = 0 while sub_string in string: counter += 1 find = string.find(sub_string) string = string[find + 1:] return counter