Parser needed.

MRAB python at mrabarnett.plus.com
Tue Jun 2 12:43:05 EDT 2015


On 2015-06-02 05:45, Skybuck Flying wrote:
> Example for python:
>
> MyString = "Hello World"
>
> print MyString.rfind("World")
> if MyString.rfind("World"):
> print "yes"
> else:
> print "no"
>
> Pretty cool.
>
.rfind returns the index if found, -1 if not found.

"World".rfind("World") returns 0, which will be treated as false.

"foo".rfind("World") returns -1, which will be treated as true.




More information about the Python-list mailing list