Re: string.find first before location

2006-05-03 Thread Kent Johnson
Gary Wessle wrote: > ps. is there a online doc or web page where one enters a method and it > returns the related docs? The index to the library reference is one place: http://docs.python.org/lib/genindex.html and of course help() in the interactive interpreter... Kent -- http://mail.python.org

Re: string.find first before location

2006-05-02 Thread Gary Wessle
"Serge Orlov" <[EMAIL PROTECTED]> writes: > 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, he

Re: string.find first before location

2006-05-02 Thread Peter Otten
Serge Orlov wrote: > 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 >> >> >>

Re: string.find first before location

2006-05-02 Thread Serge Orlov
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

Re: string.find first before location

2006-05-02 Thread Peter Otten
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 deprec

Re: string.find first before location

2006-05-02 Thread Gary Wessle
Peter Otten <[EMAIL PROTECTED]> writes: > Gary Wessle wrote: > > > I have a string like this > > > > text = "abc abc and Here and there" > > I want to grab the first "abc" before "Here" > > > > import string > > string.find(text, "Here") # > > > > I am having a problem with the next step. >

Re: string.find first before location

2006-05-02 Thread Peter Otten
Gary Wessle wrote: > I have a string like this > > text = "abc abc and Here and there" > I want to grab the first "abc" before "Here" > > import string > string.find(text, "Here") # > > I am having a problem with the next step. These days str methods are preferred over the string module's fun

Re: string.find first before location

2006-05-02 Thread Ravi Teja
text[:text.find('Here')].rfind('abc') -- http://mail.python.org/mailman/listinfo/python-list

string.find first before location

2006-05-02 Thread Gary Wessle
Hi I have a string like this text = "abc abc and Here and there" I want to grab the first "abc" before "Here" import string string.find(text, "Here") # I am having a problem with the next step. thanks -- http://mail.python.org/mailman/listinfo/python-list