【文件属性】:
文件名称:Python 多线程搜索txt文件的内容,并写入搜到的内容(Lock)方法
文件大小:40KB
文件格式:PDF
更新时间:2021-01-01 00:54:36
c oc python
废话不多说,直接上代码吧!
import threading
import os
class Find(threading.Thread): #搜索数据的线程类
def __init__(self,datalist,startIndex,endIndex,searchstr,savefile): #datalist要搜索的内容列表,startIndex列表搜索范围的开始下标,searchstr要搜索的内容
threading.Thread.__init__(self)
self.datalist=datalist #要搜索的数据的内存地址
self.startIndex=sta