I need a simple output to show progress in my python script
e.g. I have this script
def delete_id(list):
r = del(id)
print(r.json())
list = get_list()
delete_id(list)
I need a simple output to show progress in my python script
e.g. I have this script
def delete_id(list):
r = del(id)
print(r.json())
list = get_list()
delete_id(list)
There are a few issues with your script. You don't want to use list
or id
as variable names because they are built in functions. But you can use Enlighten and do something like this:
import enlighten
items = get_list()
pbar = enlighten.Counter(total=len(items))
for id_ in pbar(items):
delete_id(id_)
If you want to do something more complicated, like have multiple progress bars, you'll want to create a manager first.
manager = enlighten.get_manager()
pbar = manager.counter()
Lot of customization and examples in the docs.