#多进程.py
from multiprocessing import Process
import os
def run_proc(name):
print('Parent child process %s (%s)...' % (name, os.getpid()))
if __name__=='__main__':
print('Parent process %s.' % os.getpid())
p = Process(target=run_proc, args=('test',))
print('Child process will start.')
p.start()
p.join()
print('Child process end.')
os.system('pause')
Parent process 8496.
Child process will start.
请按任意键继续. . .
Parent child process test (9920)...
Child process end.
请按任意键继续. . .
没法跟你交流
Parent process 8496. Child process will start. 请按任意键继续. . . Parent child process test (9920)... Child process end. 请按任意键继续. . .