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") # <type int> > > I am having a problem with the next step.
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 -- http://mail.python.org/mailman/listinfo/python-list