I'd like to count if a string can be found within a longer string.
For example, if i have the string: "Heyheyheyhey". I'd like to check how many times the part "ey" is in the string, and get the count 4. Lets say that i have this string in a list aswell.
I tried this, but it works just if the part appears one time in the string.
For word in list:
count = 0
If 'ey' in word:
count +=1
I thought exchanging the if to a while would work, but obviously not. Any tips?
this is all in PYTHON 3.x.