Read text in a Word document with Python

You can read text with this code in a Word document.

from docx import Document

document = Document("file.docx")

for p in document.paragraphs:
	print(p.text)

 


Published by pythonprogramming

Started with basic on the spectrum, loved javascript in the 90ies and python in the 2000, now I am back with python, still making some javascript stuff when needed.