对于某些关键字的出现,观察不断增长的文件尾端的pythonic方法是什么?
在shell中我可能会说:
tail -f "$file" | grep "$string" | while read hit; do #stuff done
python file tail
file ×1
python ×1
tail ×1