I don't quite get this "string".find()

Steve Holden steve at holdenweb.com
Thu Nov 11 20:14:26 EST 2004


Jaime Wyant wrote:

> Will someone explain this to me?
> 
> 
>>>>"test".find("")
> 
> 0
> 
> Why is the empty string found at position 0?
> 

Think of it this way: "test".find("") returns the index of the first 
position in "test" where a substring of length len("") occurs equal to "".

the-empty-set-is-a-subset-of-all-sets-ly y'rs  - steve
-- 
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119



More information about the Python-list mailing list