1 # -*- coding: utf-8 -*- 2 import glob 3 filepath = glob.glob('**/kernel_log*', recursive=True) 4 print(filepath) 5 6 for path in filepath: 7 with open(path, mode='r', encoding='utf-8') as f: 8 print("filepath is " + path) 9 line_num = 1 10 for line in f.read().splitlines(): 11 if cam_err in line: 12 print(str(line_num)+":"+line) 13 line_num += 1 14 print("-"*10 + "end" + "-"*10)View Code