The count
function of strings return the number of non-overlapping occurrences of substring. However, when I try to count empty string in non-empty or empty string, it does not give 0, but len(str) + 1.
>>> 'aaa'.count('') # it should have been 0
>>> 4
>>> ''.count('') # it should have been 0
>>> 1
What is the logic behind this?