+ 2
Can anyone help how to open microsoft word file in python 3 using open statement
6 Antworten
+ 4
Microsoft Word documents are not plain text files, so you can't simply use `open` command for that like you would open a text file.
A quick search on the net for this topic lead me to a conclusion that a module is needed to do the task. I will leave you with the related links resulted from the search
https://stackabuse.com/reading-and-writing-ms-word-files-in-JUMP_LINK__&&__python__&&__JUMP_LINK-via-python-docx-module/
https://python-docx.readthedocs.io/en/latest/index.html
+ 2
Thanks everyone
+ 1
file = open("/storage/emulated/0/Documents/Dino sololearn.docx", "r")
cont = file.read()
print(cont)
file.close()
+ 1
The above was the code which i have written
0
Dino Gupta
It wont work 😁
And also not work in Sololearn
You have to use any IDE in computer
like visual code studio ,sublime text etc
...
If u have word file upload it to dropbox and use its link..
file = open("paste file link here", "r")
cont = file.read()
print(cont)
file.close()
0
R...K
What is the difference between my and your code??