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.
if subject and 'python' in subject.lower():
print subject
What is the structure of "message"? I guess it's a dictionary but what
is its structure? What are the keys? Is the structure constant or does
it change depending upon the content of the mbox?
I'm a bit new to python documentation. How would a potential user of the
"mailbox" library determine these things? Or did I miss something?
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 for additional functionality.
--
https://mail.python.org/mailman/listinfo/python-list