Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > de.comp.lang.python > #4321

Re: [Python-de] Datum aus Mails parsen

From Christopher Arndt <chris@chrisarndt.de>
Newsgroups de.comp.lang.python
Subject Re: [Python-de] Datum aus Mails parsen
Date 2016-03-22 23:44 +0100
Message-ID <mailman.24.1458687052.2244.python-de@python.org> (permalink)
References <2799516.e1sbLbDSJX@horus>

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Am 22.03.2016 um 20:59 schrieb Florian Lindner:
> ich will das Datum einer Mail rausfinden, ob es das Sende- oder Empfangsdatum 
> ist, oder eins der Stationen in der Mitte ist egal.
>
> Nun frage ich mich, was da am zuverlässigsten ist?

Du musst wissen, ob dir das Datum nah an der Quelle oder am Empänger
wichtiger ist.

Such dir eins aus:

    import email
    from dateutil.parser import parse  # [1]

    with open('mail.eml') as fp:
        mail = email.message_from_file(fp)

        dates = [parse(recv.split(';')[1])
                 for recv in mail.get_all('Received')]


Chris

[1] https://pypi.python.org/pypi/python-dateutil/

Back to de.comp.lang.python | Previous | Next | Find similar


Thread

Re: [Python-de] Datum aus Mails parsen Christopher Arndt <chris@chrisarndt.de> - 2016-03-22 23:44 +0100

csiph-web