Internet Data Handling » mailbox

Adam Jensen hanzer at riseup.net
Fri Oct 21 22:43:55 EDT 2016


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?




More information about the Python-list mailing list