标签:for pytho strip() nbsp 监听 adl file rip ***
1 #基础 2 def tail(filename): 3 f = open(filename,encoding=‘utf-8‘) 4 while True: 5 line = f.readline() 6 if line: 7 print("****",line.strip()) 8 tail(‘file‘) 9 10 #进阶 11 def tail(filename): 12 f = open(filename,encoding=‘utf-8‘) 13 while True: 14 line = f.readline() 15 if line.strip(): 16 yield line.strip() 17 18 g = tail(‘file‘) 19 for i in g: 20 #if ‘python‘ in i: 21 print(‘***‘,i)
标签:for pytho strip() nbsp 监听 adl file rip ***
原文地址:https://www.cnblogs.com/20181013python/p/9978557.html