I am trying to figure out how to remove the last occurrence of a string of characters at the bottom of a file. I've got the following script, but it's not doing as requested. Any ideas would be greatly appreciated.
iter = r"(\*)+"found = re.findall(iter, finalOutput)[-1]finalOutput.replace(found, "")
Open in new window
I also allowed for space characters after the last * characters, just in case there are some.