with open("test.txt","w") as f: for row in f.readlines(): if "工程" in row or "服务" in row or"新建" in row: print(row)