给子进程传递参数

1 from multiprocessing import Process
2 import os
3 
4 def test(name):
5     print("pid=%d,ppid=%d,,,,参数=%s"%(os.getpid(),os.getppid(),name))
6 # args为元组
7 p = Process(target = test, args = ("nameValue",))
8 p.start()
9 print("___main---pid==%d"%os.getpid())

猜你喜欢

转载自www.cnblogs.com/qiushanjian/p/10333358.html