from multiprocessing import Lock, Manager, Pool, managers
all_manager = Manager()
all_dict = all_manager.dict()
all_lock = all_manager.Lock()
def run():
p = Pool(processes=16)
array = [1,2,3]
results = []
for i in array :
ret = p.apply_async(get_ths_code_by_html,
args=(
i,
))
results.append(ret)
#r ,success = get_ths_code_by_html(ts_code_key)
p.close()
p.join()
for r in results:
print(r.get())
把 apply_async 返回的结果加到list里就ok了