with open(r'C:\排版.txt', 'r',encoding='utf-8') as f: for line in f: if "专业负责人"in line: print(line.strip())