python线程池传参demo
作者:互联网
import threadpool def hello(name): for i in range(0,5): print(name+str(i)) if __name__ == "__main__": # print(hello("test")) val_pool=[] for i in range(0,2): var_dict={"name":"test"+str(i)} var_tup=(None,var_dict) val_pool.append(var_tup) print(val_pool) pool=threadpool.ThreadPool(10) requests = threadpool.makeRequests(hello, val_pool) for req in requests: pool.putRequest(req) pool.wait()
标签:__,池传参,name,val,python,print,线程,var,pool 来源: https://www.cnblogs.com/to-here/p/16444312.html