如何将msg文件转换为txt并替换内容?

2024-04-25 07:22:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我想对.msg文件的内容进行更改,并将其另存为.msg文件(在消息正文中,我想将'example.com'替换为'replpement_text.com')。无法继续

import extract_msg
folder = r"C:\Users\My_desk\Downloads\New folder"
with os.scandir(folder)as files:
    files = os.scandir(folder)
    for file in files:
        msg = extract_msg.Message(file)
        msg_sender = msg.sender
        msg_date = msg.date
        msg_subj = msg.subject
        msg_message = msg.body

Tags: 文件com消息内容dateosexampleextract