python IMAP和email模块以及whitesp的问题

2024-10-01 22:28:34 发布

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

在阅读邮件正文(gmail)时,似乎有一些不一致之处。你知道吗

result, ems =mail.search(None,'ALL')#'UNSEEN')
if(result=='OK' and ems!=['']):
    for em in ems[0].split():
        preparse = mail.fetch(em,"(RFC822)")
        msg = email.message_from_string(preparse[1][0][1])
        for part in msg.get_payload():
            if part.get_content_type() == 'text/plain':
                to_verify = part.get_payload()
                print to_verify
                verified = verify(to_verify)

问题在于你需要核实。它与直接从我的web浏览器复制+粘贴的版本不一致。不需要的地方有'\n',添加了'\r'。这给我用gnupg验证签名带来了麻烦。我能做些什么来解决这个问题吗?你知道吗


Tags: toinforgetif邮件mailmsg

热门问题