python real-time read the log, three lines of code simple and crude

Ado directly on the code, named xx.py

import sys
while True:
line = sys.stdin.readline()
print(line)

Use: tail -f xxxx.log | xx.py

You can print () rewrite the way you want to handle. Simple and quick.

Guess you like

Origin www.cnblogs.com/walkerwang731/p/10986576.html