Home > database >  Progressbar in a function Python
Progressbar in a function Python

Time:10-17

Hi guys so i have this function that do a tracert in python. I want to insert a progress bar because take some time to execute the commmand. I tried but didin't work. Any good soul can help ?

def tracertapp():  
    def tracert1(x):
        trc= f"tracert {x}"
        result1 = subprocess.check_output(f"{trc}", shell=True, universal_newlines=True)     
        print(result1)
    
    ip = input("Insert the ip: ")
    tracert1(ip)
tracertapp()

I just want a progress bar in this wile load the information. Thanks for helping. I'm just new in Python.

CodePudding user response:

u can use tqdm, its very simple and u can use it perfect for ur project.

from tqdm import tqdm

for i in tqdm(range(10000)):
...

CodePudding user response:

Try using the proglog package.

It has default progress bar as well as lets you come up with custom ones.

Its really easy to implement aswell.

  • Related