Re: Internet Data Handling » mailbox

2016-10-24 Thread Adam Jensen
On 10/22/2016 11:56 PM, Jason Friedman wrote: >> >> for message in mailbox.mbox(sys.argv[1]): >> if message.has_key("From") and message.has_key("To"): >> addrs = message.get_all("From") >> addrs.extend(message.get_all("To")) >> for addr in add

Re: Internet Data Handling » mailbox

2016-10-23 Thread Jon Ribbens
On 2016-10-23, Jason Friedman wrote: >> >> for message in mailbox.mbox(sys.argv[1]): >> if message.has_key("From") and message.has_key("To"): >> addrs = message.get_all("From") >> addrs.extend(message.get_all("To")) >> for addr in addrs: >>

Re: Internet Data Handling » mailbox

2016-10-23 Thread Jon Ribbens
On 2016-10-23, Jon Ribbens wrote: > On 2016-10-23, Jason Friedman wrote: >>> >>> for message in mailbox.mbox(sys.argv[1]): >>> if message.has_key("From") and message.has_key("To"): >>> addrs = message.get_all("From") >>> addrs.extend(message.get_all("To"))

Re: Internet Data Handling » mailbox

2016-10-23 Thread Jason Friedman
> > for message in mailbox.mbox(sys.argv[1]): > if message.has_key("From") and message.has_key("To"): > addrs = message.get_all("From") > addrs.extend(message.get_all("To")) > for addr in addrs: > addrl = addr.lower() >

Re: Internet Data Handling » mailbox

2016-10-23 Thread andy
Sat, 22 Oct 2016 19:41:45 -0400 wrote Adam Jensen: > On 10/22/2016 05:47 AM, andy wrote: >> I would type: help(mailbox) after importing it. > > I guess the output of that might be more meaningful once I understand > the underlying structures and conventions. yes - you are right. fortunatelly pyt

Re: Internet Data Handling » mailbox

2016-10-22 Thread Adam Jensen
On 10/21/2016 11:22 PM, MRAB wrote: > The docs say that it's subclass of the email.message module's Message. > > You can get the email's header fields like it's a dict, except that the > field names are case-insensitive. The author(s) of the module couldn't > use a true dict because of the need fo

Re: Internet Data Handling » mailbox

2016-10-22 Thread Adam Jensen
On 10/22/2016 03:24 AM, dieter wrote: > In addition to the previous (excellent) responses: > > A "message" models a MIME (RFC1521 Multipurpose Internet Mail Extensions) > message (the international standard for the structure of emails). > The standard tells you that a message consists essentially

Re: Internet Data Handling » mailbox

2016-10-22 Thread Adam Jensen
On 10/22/2016 05:47 AM, andy wrote: > I would type: help(mailbox) after importing it. I guess the output of that might be more meaningful once I understand the underlying structures and conventions. -- https://mail.python.org/mailman/listinfo/python-list

Re: Internet Data Handling » mailbox

2016-10-22 Thread Adam Jensen
On 10/21/2016 11:45 PM, Ben Finney wrote: > So each instance you're getting has (a superset of) the API of > ``email.message.Message``, which is a lot of behaviour > https://docs.python.org/2.7/library/email.message.html#email.message.Message> > including being able to interrogate the message heade

Re: Internet Data Handling » mailbox

2016-10-22 Thread andy
Fri, 21 Oct 2016 22:43:55 -0400 wrote Adam Jensen: > The mailbox library documentation seems to be a little weak. In this > example: > > https://docs.python.org/2.7/library/mailbox.html#examples > > import mailbox for message in mailbox.mbox('~/mbox'): > subject = message['subject'] #

Re: Internet Data Handling » mailbox

2016-10-22 Thread dieter
Adam Jensen writes: > ... > https://docs.python.org/2.7/library/mailbox.html#examples > > import mailbox > for message in mailbox.mbox('~/mbox'): > subject = message['subject'] # Could possibly be None. > if subject and 'python' in subject.lower(): > print subject > > What is

Re: Internet Data Handling » mailbox

2016-10-21 Thread Ben Finney
Adam Jensen writes: > import mailbox > for message in mailbox.mbox('~/mbox'): > subject = message['subject'] # Could possibly be None. > if subject and 'python' in subject.lower(): > print subject > > What is the structure of "message"? You're binding that name to each item

Re: Internet Data Handling » mailbox

2016-10-21 Thread MRAB
On 2016-10-22 03:43, Adam Jensen wrote: The mailbox library documentation seems to be a little weak. In this example: https://docs.python.org/2.7/library/mailbox.html#examples import mailbox for message in mailbox.mbox('~/mbox'): subject = message['subject'] # Could possibly be None.