to count the occurrence of one string in other string in python
python, string
Solution
Use `str.count()`:
>>> str1 = "ABCD"
>>> str2 = "ABCD is ABCD"
>>> str2.count(str1)
2
Problem
If this is the first string : `ABCD` if this is the second string: `ABCD is ABCD` I want to count the occurrence of first string in the second string and that too in python. How can I do that?I'm new to python, so facing some problems. Can anyone tell me the solution or provide the code for the same.