def tail(filename): f = open(filename,encoding=‘utf-8‘) while True: line = f.readline() if line: yield line.strip() g = tail(‘file‘) for i in g: print(i)
原文地址:https://www.cnblogs.com/fate2048/p/9691609.html
时间: 2024-09-30 16:51:42
def tail(filename): f = open(filename,encoding=‘utf-8‘) while True: line = f.readline() if line: yield line.strip() g = tail(‘file‘) for i in g: print(i)
原文地址:https://www.cnblogs.com/fate2048/p/9691609.html