我想知道是否可以将自定义变量添加到 tqdm 栏,其中该值有时会随着每次迭代而更新。例如:
exception_count = 0
for _ in tqdm(range(1000), bar_format="Exceptions: counthere | Elapsed: {elapsed} |{rate_fmt}"):
try:
do_stuff()
except Exception:
exception_count += 1
Run Code Online (Sandbox Code Playgroud)
我想exception_count在bar_format参数的某处添加变量作为自定义错误计数器的类型。