search backward
Aaron Bingham
bingham at cenix-bioscience.com
Tue Jan 4 04:37:34 EST 2005
Robert wrote:
> I need to find the location of a short string in a long string. The
> problem however is that i need to search backward.
>
> Does anybody know how to search in reverse direction?
>>> "foofoo".find("foo")
0
>>> "foofoo".rfind("foo")
3
>>> "foofoo".index("foo")
0
>>> "foofoo".rindex("foo")
3
--
--------------------------------------------------------------------
Aaron Bingham
Application Developer
Cenix BioScience GmbH
--------------------------------------------------------------------
More information about the Python-list
mailing list