How do I write a python script that can read doc/docx files and convert them to txt?

前端 未结 3 1033
终归单人心
终归单人心 2021-01-29 09:26

Basically I have a folder with plenty of .doc/.docx files. I need them in .txt format. The script should iterate over all the files in a directory, convert them to .txt files an

3条回答
  •  孤城傲影
    2021-01-29 10:12

    conda install -c conda-forge python-docx

    from docx import Document doc = Document(file)

    for p in doc.paragrafs: print(p.text) pass

提交回复
热议问题