python实时读取日志,三行代码简单粗暴
时间:2019-06-06 20:00:31
收藏:0
阅读:690
废话不多说直接上代码,命名xx.py
import sys
while True:
line = sys.stdin.readline()
print(line)
使用方式:tail -f xxxx.log | xx.py
可以把print()改写成你要处理的方法。简单快捷。
原文:https://www.cnblogs.com/walkerwang731/p/10986576.html
评论(0)