I don't quite get this "string".find()
Isaac To
iketo2 at netscape.net
Thu Nov 11 19:57:46 EST 2004
More information about the Python-list mailing list
Thu Nov 11 19:57:46 EST 2004
- Previous message (by thread): I don't quite get this "string".find()
- Next message (by thread): I don't quite get this "string".find()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>>>> "Jaime" == Jaime Wyant <programmer.py at gmail.com> writes: Jaime> Will someone explain this to me? >>>> "test".find("") Jaime> 0 Jaime> Why is the empty string found at position 0? It is completely natural. "test".find("es") = 1 because 1 is the smallest x such that "test"[x:x+len("es")] == "es" (i.e., the smallest x such that the substring of "test" from position x starts with "es"). Now what is the smallest x such that "test"[x:x+len("")] == ""? Regards, Isaac.
- Previous message (by thread): I don't quite get this "string".find()
- Next message (by thread): I don't quite get this "string".find()
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list