员工被要求连续工作37天,无加班费?官方:已展开调查
时间:2024-10-16 10:39:07
注意:是在win环境下哦
直接上代码吧
#!/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 """ 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: if k == '-f': path = v elif k == '-h': print __doc__ return 0 if not (path and os.path.exists(path)): print 'Invalid path: %s' % path print __doc__ return 2 #命令行元组 cmd = ('tail', '-f', path) print ' '.join(cmd) output = subprocess.Popen(cmd, stdout=subprocess.PIPE) keywordMap = {} #加载监控的关键字信息 with codecs.open(os.path.join(ABSPATH, MONITERCONF), 'r', 'utf8') as f: lines = f.readlines() for line in lines: line = line.strip() if not line: continue keyword, wav = line.strip().split(':') keywordMap[keyword] = wav while True: line = output.stdout.readline() #process code,得到
声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。