[Python-Dev] Dafanging the find() gotcha

Andrew Koenig ark@research.att.com
06 Aug 2002 00:12:07 -0400


Tim>     s2.find(s1)

Tim> returns the smallest non-negative int i such that

Tim>     s2[i : i+len(s1] == s1

Tim> provided such an i exists.  That's as sensible as any answer, and more
Tim> sensible than most <wink>, if you have to give a meaning when s1 is empty.

Well, no -- you have to put the missing parenthesis in first.

Here it is.....   :-)

-- 
Andrew Koenig, ark@research.att.com, http://www.research.att.com/info/ark