How do I use a progress bar when my script is doing some task that is likely to take time?
For example, a function which takes some time to complete and returns
This is my simple solution:
import time def progress(_cur, _max): p = round(100*_cur/_max) b = f"Progress: {p}% - ["+"."*int(p/5)+" "*(20-int(p/5))+"]" print(b, end="\r") # USAGE: for i in range(0,101): time.sleep(0.1) progress(i,100) print("..."*5, end="\r") print("Done")