string.find first before location

Serge Orlov Serge.Orlov at gmail.com
Tue May 2 14:11:02 CEST 2006


Peter Otten wrote:
> Gary Wessle wrote:
>
> >> These days str methods are preferred over the string module's functions.
> >>
> >> >>> text = "abc abc and Here and there"
> >> >>> here_pos = text.find("Here")
> >> >>> text.rfind("abc", 0, here_pos)
> >> 4
> >>
> >> Peter
> >
> > and what about when python 3.0 is released and those depreciated
> > functions like find and rfind are not supported. is there another
> > solution which is more permanent?
>
> I think the functions may go away, the methods will stay; so I'm confident
> the above will continue to work.

find and rfind methods are in danger too. AFAIR they are to be replaced
by partion and rpartition methods. People who are worried about future
can continue to use index and rindex




More information about the Python-list mailing list