We all know how to find the first targeted string in a string.
string.index('abc')
So this code will help me to find the first place that 'abc' appears in string.
However, I want to know how to find the last 'abc' location.
I already figured out an algorithm, but it is stupid.
1. reverse whole string and 'abc'.
2. temp_Location = string.index('cba')
3. exactly_Location = len(string) - temp_Location - len('cba')
I know it is really silly... Can somebody tell me how to do it smart?
Thanks a lot. :)