目录
6万行的文本文件,python遍历查找和powerchell 查找方式对比
6万行的文本文件,python遍历查找和powerchell 查找方式对比
代码:
import os
import re
import subprocess
import time
if __name__ == '__main__':
file_path=r'./xxx.txt'
keywords = ['aaa', 'tracks.txt'] # 你的关键字列表
start = time.time()
with open(file_path, 'r',encoding='utf-8') as file:
for line_no, line in enumerate(file, start=1):
if all(keyword in line for keyword