I'm trying to use docx library, but I'm getting this error:
AttributeError: 'module' object has no attribute 'Document'
This is my code:
import docx
document = docx.Document('file.docx')
What is happening? I already used document in other computers. I installed docx library using pip:
pip install docx
your'e confusing package docx
with the package python-docx
.
pip install python-docx
>>> import docx
>>> docx.Document
<class 'docx.api.Document'>
But you are right the naming here is a problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With