对于DOCX文档,我这样做:
document = zipfile.ZipFile(path) soup = BeautifulSoup(document.read('word/document.xml'), 'html.parser')
如何对DOC文档执行此操作?
DOCX足够强大,难以处理,它们基于XML,并由国际标准组织进行了文档记录。 DOC文件是二进制文件和专有文件。
请勿尝试直接处理DOC文件。 首先将它们转换为DOCX。
See: