Asked By – Dror Hilman
When using the tqdm progress bar: can I add a message to the same line as the progress bar in a loop?
I tried using the “tqdm.write” option, but it adds a new line on every write. I would like each iteration to show a short message next to the bar, that will disappear in the next iteration. Is this possible?
Now we will see solution for issue: Can I add message to the tqdm progressbar?
You can change the description to show a small message before the progress bar, like this:
from tqdm import trange from time import sleep t = trange(100, desc='Bar desc', leave=True) for i in t: t.set_description("Bar desc (file %i)" % i) t.refresh() # to show immediately the update sleep(0.01)