Can I add message to the tqdm progressbar?
The example shown in Usage of tqdm works well for me.
pbar = tqdm(["a", "b", "c", "d"])for char in pbar: pbar.set_description("Processing %s" % char)
You can change the description to show a small message before the progress bar, like this:
from tqdm import trangefrom time import sleept = 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)
/EDIT: in the latest releases of tqdm
, you can use t.set_description("text", refresh=True)
(which is the default) and remove t.refresh()
(thanks to Daniel for the tip).