14.4. Processing a Eudora Mailbox

The following code fragment shows the control structure required to process a Eudora mailbox into individual e-mail messages. The processing of each message has been delegated to the ProcessMessage function. This function is used by both the Linux and Eudora converters. Note how the sentinel string "From ???@???" is used to chop the contents of the mailbox into individual messages.

 CD-ROM reference=14005.txt def DoEudoraMailbox(f): # f is a file object. # Chop the contents of a Eudora mailbox # into individual messages for processing # by the ProcessMessage subroutine. Message = [] L = f.readline() while L: if string.find(L,"From ???@???")!=-1: # Full message accumulated in the Message # list, so process it ...

Get XML Processing with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.