I'm using tqdm as a nice progressbar, but after iterating over the progressbar I want to update the description.
The following is a simple example:
with tqdm(somelist) as pbar:
for element in pbar:
foo(element)
pbar.set_description('We finished')
I get the output:
100%|███████████████████████████████████████| 10/10 [00:00<00:00, 239674.51it/s]
but expected:
We finished: 100%|███████████████████████████| 10/10 [00:00<00:00, 239674.51it/s]
I've tried pbar.update()
, pbar.refresh()
and refresh=True
as a parameter for set_description
, neither worked.
Of course, one can always print or use tqdm.write()
, but would be neater to have besides the progress bar.