Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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
Source by www.includehelp.com #
 
PREVIOUS NEXT
Tagged: #python #substring #count
ADD COMMENT
Topic
Name
5+4 =