On Wed, Apr 21, 2010 at 1:51 AM, Stef Mientki <stef.mien...@gmail.com> wrote: > With the following code, I would expect a result of 5 !! > >>>> a= 'word1 word2 word3' >>>> a.rfind(' ',7) > 11 > > Is this a bug ?
No. Don't you think someone would have found such an obvious bug by now? You want regular str.find(), which searches from left-to-right: >>>> a= 'word1 word2 word3' >>> a.find(' ') 5 str.rfind() is a variant of str.find() that searches from right-to-left. The "r" is for "right". Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list