一名后端程序员现在需要你写代码具体写代码内容如下python 删除word文档的属性和个人信息 。要求整体内容的风格为:尽量简单直接一点
import win32com.client
读取Word文档
word = win32com.client.Dispatch('Word.Application') doc = word.Documents.Open('example.docx')
删除属性和个人信息
doc.RemoveDocumentInformation(2) # 删除元数据信息 doc.RemovePersonalInformation = True # 删除个人信息
保存并关闭文档
doc.Save() doc.Close()
退出Word
word.Quit()
原文地址: https://www.cveoy.top/t/topic/7O6 著作权归作者所有。请勿转载和采集!