While循环检查多处理

时间:2019-09-23 11:36:21

标签: python while-loop multiprocessing

我的代码上有一个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

0 个答案:

没有答案
相关问题