标签:pool cut tor 大小 BMI executor OLE print return
from concurrent.futuress import ThreadPoolExecutor,ProcessPoolExecutor
def f1(n,s):
return n+s
def f2(n):
print(‘回调函数>>>‘,n.result())
if __name__ == ‘__main__‘:
tp = ThreadPoolExecutor(4)#指定线程池的大小
res = tp.submit(f1,1,2).add_done_callback(f2)#添加回调函数
回调函数定义:将F1函数中的return返回值作为参数传给f2
标签:pool cut tor 大小 BMI executor OLE print return
原文地址:https://www.cnblogs.com/16795079a/p/10269191.html