我有一个多线程函数,我想要一个状态栏来使用tqdm
. 有没有一种简单的方法来显示状态栏ThreadPoolExecutor
?令我困惑的是并行化部分。
import concurrent.futures
def f(x):
return f**2
my_iter = range(1000000)
def run(f,my_iter):
with concurrent.futures.ThreadPoolExecutor() as executor:
function = list(executor.map(f, my_iter))
return results
run(f, my_iter) # wrap tqdr around this function?