[Tutor] Trouble parsing email from Outlook

Tim Golden mail at timgolden.me.uk
Fri Mar 20 22:18:52 CET 2009

Eduardo Vieira wrote:
> On Fri, Mar 20, 2009 at 2:29 PM, Eduardo Vieira <eduardo.susan at gmail.com> wrote:
>> On Fri, Mar 20, 2009 at 9:04 AM, Tim Golden <mail at timgolden.me.uk> wrote:
>>> Eduardo Vieira wrote:
>>>> Thank you very much, Tim for the thorough explanation. Much more than
>>>> I could expect. It will be specially useful for me a newbie python
>>>> amateur programmer. I will try your guidance as soon as possible
>>>> today, and see my progress.
>>> That's ok; might be worth posting back to the list to say
>>> whether it worked or not. All the posts go into the archive
>>> so people looking in the future for the same kind of solution
>>> might be interested to know if my suggestion worked or
>>> whether there were any other obstacles.
>>> TJG
>> Thanks again. I tried the code, trying to reformat the spaces and came
>> up with this code: http://paste.lisp.org/display/77353
>> I'm not sure if I indented correctly, and the result it gave me was:
>> Searching Archive Folders
>> Searching Mailbox - Eduardo Silva
>> I don't understand the part "for folder, folders, items in cdo_walk
>> (info_store.RootFolder):"
>> RootFolder is IPM_SUBTREE if I check the Name value
> I worked! sorry, I had to just align "raise x_found" with the "for"
> statement, thank you very much!

Glad you got it working. The "for folder, folders, items in..." bit
is looping over each folder (with its subfolders and subitems) in
turn. cdo_walk is a generator -- a function-type mechanism which keeps
returning values, rather than just returning once. Because of that,
you can keep looping over it as it walks down the tree of folders,
recursively in this case altho' other approaches are possible.

FWIW, RootFolder is nearly always IPM_SUBTREE; its name doesn't
really matter: it's just a place to start looking.

Sorry about the formatting. With something more than a few lines
long I usually stick it in pastebin or wherever, but I was moving
too quickly when I wrote that this morning!


More information about the Tutor mailing list