a = "A long string with a . in the middle ending with ."
# if you want to find the index of the last occurrence of any string, In our case we #will find the index of the last occurrence of with
index = a.rfind("with")
# the result will be 44, as index starts from 0.