Question about logfiles in Python

Harlin Seritt harlinseritt at yahoo.com
Wed Feb 23 21:36:06 EST 2005


I'm not familiar with Exchange log files but this can be done rather
easily assuming the log file is a flat text file (which usually these
are not-- like NT event logs).

search_str = "words and phrases"
data = open(LogFile, 'r').read()

if search_str in data:
   flag = 1

If they are binary files, you may have to use a special module (or
write one yourself if it doesn't exist). A good place to look is in
Mark Hammond's Win32 modules. You'll find some stuff here:
http://starship.python.net/crew/mhammond/

Hope this sends you in the right direction.




More information about the Python-list mailing list