string.find first before location

Peter Otten __peter__ at web.de
Tue May 2 07:24:48 EDT 2006


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. 

Peter



More information about the Python-list mailing list