target函數的參數如下:
示例:
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()