0
我正在阅读Python 3 docs here,我必须是盲人或其他什么的......它在哪里说如何得到消息的正文?如何从message.parser.Parser返回的Message对象中获取消息正文(或正文)?
我想要做的是打开一条消息,并在消息的基于文本的主体中执行一些循环,跳过二进制附件。伪代码:
def read_all_bodies(local_email_file):
email = Parser().parse(open(local_email_file, 'r'))
for pseudo_body in email.pseudo_bodies:
if pseudo_body.pseudo_is_binary():
continue
# Pseudo-parse the body here
我该怎么做?甚至是消息类正确的类吗?它不只是用于标题吗?