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)
Or alternatively, starting Python 3.8 which supports the walrus operator :=
:
for char in (pbar := tqdm(["a", "b", "c", "d"])):
pbar.set_description(f"Processing {char}")