下面是编程之家 jb51.cc 通过网络收集整理的代码片段。
编程之家小编现在分享给大家,也给大家做个参考。
#!/usr/bin/env python
# encoding: utf-8
"""
MonitorLog.py
Usage: MonitorLog.py ...
Monitor the log file
-f log file
-h help info
python MonitorLog.py -f C:\monitor.log
Created by zhoubo on 2011-08-29.
"""
import sys
import os
import getopt
import subprocess
import time
import codecs
import winsound
ABSPATH = os.path.dirname(os.path.abspath(__file__))
MONITERCONF = 'moniter_keyword.txt' #utf8 file
def main():
try:
opts,args = getopt.getopt(sys.argv[1:],'hf:')
except getopt.GetoptError,err:
print str(err)
print __doc__
return 1
path = ''
for k,v in opts:
i