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/mwBR 著作权归作者所有。请勿转载和采集!