target函數(shù)的參數(shù)如下:
示例:
import multiprocessing
def worker(num):
print(f"Worker: {num}")
if __name__ == "__main__":
p1 = multiprocessing.Process(target=worker, args=(1,))
p2 = multiprocessing.Process(target=worker, args=(2,))
p1.start()
p2.start()