I'm a video editor trying to automate word docs of talent scripts into STR files for captions to speed up the process. Since each video is structured the same, the idea works pretty well. In the scripts, there are editing directions that I'm trying to remove from the STR file I'm creating with Python and the python-docx library by using the .replace() function, however this doesn't seem to be working. These all begin with '(CUT' and the following possible sentences vary. The program correctly picks up where these sentences are occurring but the replace function yields no resulting change. What am I doing wrong here?
for x in range(2,len(doc.paragraphs)):
newPara = doc.paragraphs[x].text
if (newPara.find('(CUT') != -1):
newPara.replace('(CUT', '')
if (newPara.find('COMPLETE)') != -1):
newPara.replace(' AWAY COMPLETE)', '')
elif (newPara.find('TITLE)') != -1):
newPara.replace(' AWAY TO TITLE)', '')
elif (newPara.find('SIDE)') != -1):
newPara.replace(' BACK TO SIDE)', '')