[Python] python通过Queue在多个子进程间交换数据 →→→→→进入此内容的聊天室

来自 , 2019-08-14, 写在 Python, 查看 127 次.
URL http://www.code666.cn/view/44bf89b6
  1. from multiprocessing import Process, Queue
  2.  
  3. def f(q):
  4.     q.put([42, None, 'hello'])
  5.  
  6. if __name__ == '__main__':
  7.     q = Queue()
  8.     p = Process(target=f, args=(q,))
  9.     p.start()
  10.     print q.get()    # prints "[42, None, 'hello']"
  11.     p.join()
  12. #//python/8367

回复 "python通过Queue在多个子进程间交换数据"

这儿你可以回复上面这条便签

captcha