from multiprocessing import Process
import time
def sing():
for i in range(3):
time.sleep(1)
print('唱完第%d首歌'%i)
def dance():
for i in range(3):
time.sleep(1)
print('跳完第%d段舞蹈'%i)
if __name__ == '__main__':
p=Process(target=sing)
p.start()
dance()
使用进程控制多任务
最新推荐文章于 2023-05-08 21:09:57 发布