I don't quite get this "string".find()
caleb1 at telkomsa.net
Fri Nov 12 04:28:46 CET 2004
I don't know why the function was set up this way. However, an empty
string can be found in an infinite number of places within any other
string. It is a difficult situation, like dividing zero into a nonzero
number. (Are you asking why it specifically returns 0 and not INF or an
If you want to match a *blank*, you gotta do
>>> "test".find(" ") # There is a space between the last two ""s
but I expect you are aware of this and this was not your question. Also,
if you want to check whether a string is empty, I do
>>> "test" == ""
One of the gurus can probably answer you better than I.
On Thu, 11 Nov 2004 13:36:41 -0600, Jaime Wyant <programmer.py at gmail.com>
> Will someone explain this to me?
> Why is the empty string found at position 0?
More information about the Python-list