读取doc文档:
import os
from win32com.client import Dispatch
word = Dispatch('Word.Application') # 打开word应用程序
# word = DispatchEx('Word.Application') # 启动独立的进程
word.Visible = 0 # 后台运行,不显示
word.DisplayAlerts = 0 # 不警告
path=os.path.join(os.path.dirname(os.path.dirname(__file__)), r'data/originaldata/my.doc')
doc = word.Documents.Open(FileName=path, Encoding='gbk')
print(doc)#文件名称 my.doc
for para in doc.paragraphs:
print(para.Range.Text)
doc.Close()