pyhton 监听文件输入实例

def tail(filename):
f = open(filename,encoding='utf-8')
while True:
line = f.readline()
if line.strip():
yield line.strip()

g = tail('file')
for i in g:
if 'python' in i:
print('***',i)
posted @ 2019-03-24 11:41  干干干  阅读(159)  评论(0编辑  收藏  举报