Efficient grep using Python?

2004-12-15 Thread sf
Just started thinking about learning python.

Is there any place where I can get some free examples, especially for
following kind of problem ( it must be trivial for those using python)

I have files A, and B each containing say 100,000 lines (each line=one
string without any space)

I want to do

"  A  - (A intersection B)  "

Essentially, want to do efficient grep, i..e from A remove those lines which
are also present in file B.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Efficient grep using Python?

2004-12-17 Thread sf
The point is that when you have 100,000s of records, this grep becomes
really slow?

Any comments?

Thats why I looked for python :)


> that would be
>
> grep -vf B A
>
> and it is a rare use of grep, indeed.
> -- 
> TZOTZIOY, I speak England very best.
> "Be strict when sending and tolerant when receiving." (from RFC1958)
> I really should keep that in mind when talking with people, actually...


-- 
http://mail.python.org/mailman/listinfo/python-list


Email filters in python

2004-12-17 Thread sf
Would someome like to post their email filters code. Its so common that
probably some standard library
supports it or many would have written it already. If I have basic
structure, I can take from there.

( Essentially I want get rid of XP by getting rid of powerful mail client
"TheBat!" )

..
- open POP-SSL connection to pop.someserver.com
- Get all mails and store as Unix mail file (mymails)
- do not delete mails from server
- close connection.
..
- open mymails file

- Do following for each mail in mymails file (one by one)
{
- get header fields:  {FROM, TO, CC, Subject,... more ... }
- some conditons (FROM is found my addresslist.txt but not part of
my rejectlist.txt )
append that mail to some existing file.
}


..
- open SMTP-TLS connection to smtp.someserver.com
- send all mails in my unix mail file
- close connection
..


Thanks.


-- 
http://mail.python.org/mailman/listinfo/python-list