python 生产者消费者

def urls( q):
    """"""
    with open('kehu_ok.txt') as f:
        urls = f.readlines()
        for i in urls:
            print i
            q.put(i)
            

#----------------------------------------------------------------------
def get_info(q):
    """"""
    while True:
        res = q.get()
        if res is None:
            break
        else:
            print res
            info_scan(res)
            
if __name__ == '__main__':
    q = Queue()
    
    c = Process(target=get_info, args=(q,))

    c.start()
    get_info(q)
    
    q.put(None)


    c.join()
    print '123'

你可能感兴趣的:(python 生产者消费者)