I am not able to understand the behavior of the str.startswith
method.
If I execute "hello".startswith("")
it returns True. Ideally it doesn't starts with empty string.
>>> "hello".startswith("")
True
The documentation states:
Return
True
if string starts with the prefix, otherwise returnFalse
.prefix
can also be a tuple of prefixes to look for.
So how does the function work?
See Question&Answers more detail:os