Find a string

  • + 2 comments

    Slightly modified the answer from matheus_santos5:

    def count_substring(string, sub_string):
        count = 0
        for i in range(len(string)):
            if string[i:].startswith(sub_string):
                count += 1
        return count