0

I am trying to make docs read in python and I am not getting any error, but it also doesn't show what is written in document.

from docx import Document

import os


file = open('C:\\Users\\hamza\\Desktop\\Python\\qwe.docx','r', encoding='utf8' )

document =(file.read())
file.close()
2

1 Answer 1

1

Try pip install docx2txt

from docx2txt import process
import os
path = r'C:\Users\hamza\Desktop\Python\qwe.docx'
text = process(path)

with open(os.path.basename(path) + '.txt', 'w') as f:
    f.write(text)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.