This is what I made so far :
from docx import Document
document = Document('filename.docx')
dic = {
'Stack':'Stack Overflow',
'October 18 2021' : 'Actual Date'}
for p in document.paragraphs:
inline = p.runs
for i in range(len(inline)):
text = inline[i].text
for key in dic.keys():
if key in text:
text=text.replace(key,dic[key])
inline[i].text = text
document.save('new.docx')
But it seems that this function works fine when she need to replace one word, but whn she need to replace sentences, it doesn't work (here October 18 2021)/
Any ideas why sentences doesn't work ?