Re: Question about email-handling modules

2007-12-21 Thread thebjorn
On Dec 20, 4:15 pm, Robert Latest <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: [...] > > All methods are attributes (although the opposite is not the case), so if > > a method doesn't exist, you will get an AttributeError. > > I see. I've already gathered that Python likes to use different w

Re: Question about email-handling modules

2007-12-20 Thread Robert Latest
Steven D'Aprano wrote: > message['to'] looks up the key 'to', raising an exception if it doesn't > exist. message.get('to') looks up the key and returns a default value if > it doesn't exist. Ah, so the [] notation got hung up on some message right at the beginning and didn't even let the scri

Re: Question about email-handling modules

2007-12-20 Thread tinnews
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Thu, 20 Dec 2007 09:31:10 +, Robert Latest wrote: > [snip most of question and helpful answer] > > But note that message.get_payload() will return either a string (for > single part emails) or a list of Messages (for multi-part messages). > No

Re: Question about email-handling modules

2007-12-20 Thread Steven D'Aprano
On Thu, 20 Dec 2007 09:31:10 +, Robert Latest wrote: > 1. Why can I get the 'subject' and 'from' header field unsig the [] > notation, but not 'to'? When I print Message.keys I get a list of all > header fields of the message, including 'to'. What's the difference > between message['to'] and m

Re: Question about email-handling modules

2007-12-20 Thread Matt Nordhoff
Robert Latest wrote: > Hello, > > I'm new to Python but have lots of programming experience in C, C++ and > Perl. Browsing through the docs, the email handling modules caught my eye > because I'd always wanted to write a script to handle my huge, ancient, and > partially corrupted email archive

Question about email-handling modules

2007-12-20 Thread Robert Latest
Hello, I'm new to Python but have lots of programming experience in C, C++ and Perl. Browsing through the docs, the email handling modules caught my eye because I'd always wanted to write a script to handle my huge, ancient, and partially corrupted email archives. Of course I know that this ki