[Tutor] Matching problem....

Deirdre Saoirse deirdre@deirdre.net
Thu, 7 Oct 1999 17:32:08 -0700 (PDT)


On Thu, 7 Oct 1999, Michael P. Reilly wrote:

> Starting with:
>   >>> import string
>   >>> mbox = open(mboxfname).read()

I guess this is a question I was wondering about (and didn't explicitly
state): is it reasonable to assume that a mailbox (or even that a whole
message) for a pop session will fit in RAM?

This is not designed as an industrial-strength APOP server that will meet
all needs, but I do have to be aware that it can break, especially since
it's running as root. :)

People have a way of sending snarky attachments (like PowerPoint docs)
that are huge.

I suppose I really answered my own questions (no and no) and I'll have to
work around them. :)

> How about:
>   >>> howmanymsgs = len(string.split(mbox, '\nFile '))
> 
> This runs in under a second for 80 msgs totaling about 1.5 Mbytes.
> 
> And from the grep side, you could run. ;)
>   grep -c '^From ' /var/spool/mail/deirdre

Ah, good point. I forgot about the -c option.

-- 
_Deirdre   *   http://www.linuxcabal.net   *   http://www.deirdre.net
"Mars has been a tough target" -- Peter G. Neumann, Risks Digest Moderator
"That's because the Martians keep shooting things down." -- Harlan Rosenthal
<Harlan.Rosenthal@Dialogic.com>, retorting in Risks Digest 20.60