'''方式一:函数的多进程'''
from multiprocessing import Process
import time def test():
for i in range():
print(i)
time.sleep() if __name__ == '__main__':
# for i in range():
p = Process(target=test)
p.start()
p.join()#堵塞
print('zhu') '''方式二:类的多进程'''
from multiprocessing import Process
import time class MyProocess(Process): def run(self):
while True:
print('')
time.sleep()
if __name__ == '__main__': p=MyProocess()
p.start()#执行run属性