I know that str.count(sub)
return the number of occurrences of substring sub.
But I faced a strange problem that I cannot understand.
My code is as below:
str = 'helloworld'
print(str.count(''))
>>>11
The output is puzzling. Why does it return 11?
If ''
means any letters, why not return the length of it (10)?
I haven't found any answers about this.
Can anybody tell me about the implementation?