Searching in str backwards

Pratik Khemka pratikkhemka at
Thu Oct 14 01:28:39 CEST 2010

I  want to search for a symbol in a string backwards..
For eg:
line = "my/cat/dog/baby"
line.find('/') # but from the back...
The reason I want to do this is because I want to print the last part of the string after the '/' . And I do not know how long the string might be or how many '/' it might have . I just want to print whatever is there after the last '/'.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list