Python obtenir le motif de la chaîne
Get occurrence of substring in string
def count_substring(string, sub_string):
mycount = 0
result = 0
for x in string:
if x == sub_string[0]:
if sub_string == string[mycount:len(sub_string)+mycount]:
result = result + 1
mycount = mycount + 1
return result
Headache reliver