使用Python 2.7解析msg/eml文件 [英] Parsing msg/eml files with Python 2.7

查看:310
本文介绍了使用Python 2.7解析msg/eml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有可以解析msg或eml文件的库?我编写了一个脚本,用于在将电子邮件转换为txt文件后对其进行解析,但是我找不到能使我轻松地将gui中的电子邮件作为txt文件拖放到文件夹中的电子邮件客户端(如果有人知道的话)我很想知道!)

Is there a library that can parse msg or eml files? I wrote a script that parses an email once it is converted to a txt file, but i cannot find an email client that allows me to easily drag-n-drop emails from the gui into a folder as a txt file (if someone knows this i would love to know!)

从Outlook拖放操作将创建一个.msg文件,而Thunderbird将创建一个.eml文件.有谁知道可以像这样解析这些文件的库?

Drag-n-dropping from Outlook creates a .msg file and Thunderbird creates an .eml file. Does anyone know of a library that will parse these files like these?

推荐答案

对于* .eml文件,您可以使用电子邮件模块来自标准库.您将需要使用email.parser中的解析器来创建消息对象.

For *.eml files you can use email module from standard library. You will need to use Parser from email.parser to create a message object.

这篇关于使用Python 2.7解析msg/eml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆