内容大概是这样,要怎么解决,或者推荐一个python好用的读取doc文件的库也可以
from docx import Document
import win32com.client as wc
word = wc.Dispatch("Word.Application")
doc = word.Documents.Open(r"D:\文件\pythonProject\海运出口货物代运委托单1902 - 副本 - 副本.doc")
for para in doc.paragraphs:
print(para.Range.text)
doc.SaveAs(r"D:\文件\pythonProject\订舱委托书2103.pdf", 16)#转换后的文件,12代表转换后为docx文件
doc.Close()
word.Quit()
# document = Document("订舱委托书2103.docx")
#
# for paragraph in document.paragraphs:
# print(paragraph.text)
python-docx