【发布时间】:2018-02-19 02:29:46
【问题描述】:
我正在使用 comptypes python 3.6 并尝试阅读 office 文档,因为我需要从这些文件中提取文本。
我知道对于 word 和 ppt,这是使用 comtype 打开文件的方法
word = comtypes.client.CreateObject('Word.Application')
doc = word.Documents.Open(filename)
ppt = comtypes.client.CreateObject('PowerPoint.Application')
prs = ppt.Presentations.Open(filename)
Outlook 文件 (.msg) 怎么样?我尝试了以下代码但不起作用
ol = comtypes.client.CreateObject('Outlook.Application')
msg = ol.MailItem.Open(filename)
【问题讨论】: