Python提供了一个方便写多进程的库 --- multiprocessing
使用
1 引用库,写下定义函数--需要新的进程去执行的
from multiprocessing import Process
def get_html(n):
pass
2 实例化
progres = Process(target=get_html, args=(2,))
3 启动
progres.start()
但是这个的使用场合在哪?
高并发的时候
Python提供了一个方便写多进程的库 --- multiprocessing
使用
1 引用库,写下定义函数--需要新的进程去执行的
from multiprocessing import Process
def get_html(n):
pass
2 实例化
progres = Process(target=get_html, args=(2,))
3 启动
progres.start()
但是这个的使用场合在哪?
高并发的时候
本文标题:11-10 Python多进程multiprocessing
本文链接:https://www.haomeiwen.com/subject/tlyoiftx.html
网友评论