检测文件流中特定字符后触发

2015-07-03 0 576
检测文件流中特定字符后触发
#!/usr/bin/python
# coding: utf-8

from subprocess import Popen, PIPE

p1 = Popen("tail -f /var/log/1.txt", shell=True, stdout=PIPE)

while True:
    content = p1.stdout.readline()
    if 'end' in content:
        print 'end detected'
        break
    else:
        print content

遇见资源网 python 检测文件流中特定字符后触发 http://www.ox520.com/15621.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务