我的代码上有一个while循环,检查文件的更改。如果文件已更改,我将启动整个过程,但我想继续检查文件是否有新更改,如果文件又有新更改,则将该新进程放入队列。 我已经尝试了多处理,但是我想要的不一样。
我在这里附上我的代码:
def newpick(driver,mainpage):
initial = read_pick()
while True:
current = read_pick()
if initial != current:
for line in current:
if line not in initial:
print(line)
initial = current
t =threading.Thread(target=start,args=(driver,mainpage,current))
t.start() #start the whole process
t.join() #let the previous process finish before start the next one