test01.py 243 B

12345678910111213141516171819
  1. from multiprocessing import Process, Queue
  2. q = Queue()
  3. def f(q_main, a):
  4. q_main.put(a)
  5. print(a)
  6. if __name__ == '__main__':
  7. p = Process(target=f, args=(q, 1,))
  8. p.start()
  9. val = q.get(True)
  10. print(val)
  11. p.join()