from multiprocessing import Process
import time
def sing():
for i in range(3):
time.sleep(1)
print('唱%d首歌'%i)
def dance():
for j in range(3):
time.sleep(1)
print('跳%d段舞'%j)
if __name__ == '__main__':
#2 创建进程v
p=Process(target=sing)
#3 启动
p.start()
dance()
爬虫初学03:进程实现多任务
最新推荐文章于 2024-08-14 08:17:36 发布