I do the following:
from docx import Document
document = Document('text.docx')
document.paragraphs[42].text
And it gives me ''
whatever number I enter, and for loop to find and replace a word does not work. But if I save the document with document.save('text2.docx')
, the document is not empty.
The document is relatively big and contains many different formatting, images, tables, styles.
My task is to find and replace a word in docx document with some correction of the following word, so I will be glad, if you suggest another tool