So I have a long list of strings in the same format, and I want to find the last \".\" character in each one, and replace it with \". - \". I\'ve tried using rfind, but I can\'t
I would use a regex:
import re new_list = [re.sub(r"\.(?=[^.]*$)", r". - ", s) for s in old_list]