def tail(filename):
    f = open(filename,encoding='utf-8')
    while True:
        line = f.readline()
        if line.strip():  #strip()去掉空格/换行
            yield line.strip()

g = tail('1')
for i in g:
    if 'python' in i:   #监控含有python的语句
        print('***',i)

 

posted on 2019-06-12 12:32  wzc27229  阅读(120)  评论(0编辑  收藏  举报