I am relatively new to Python and something is working. Basically, when I call str.rfind("test") on a line, the output is the same as str.find("test") . It is best to show you an example:
Python 2.6.5 (r265:79063, May 6 2011, 17:25:59) [GCC 4.5.0 20100604 [gcc-4_5-branch revision 160292]] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import string >>> line = "hello what up" >>> line.rfind("what") 6 >>> line.find("what") 6
In my opinion, the value of line.find is fine, but the value of line.rfind should be 9 . Am I misinterpreting these functions or not using them well?
Avneesh
source share