Python Add Progress Bar

Python Add Progress Bar

You can have a Progress Bar inside of your Python code execution or the loops for Python.

Having a progress bar during execution of long loops can help you understand the current progress of the script or loop inside the script.

You can achieve this easily by the Python module ProgressBar.

Python Add Progress Bar – Install ProgressBar

You can easily install ProgressBar in Python using pip.

[[email protected] ~]# pip install progressbar

Python Add Progress Bar

Let’s take an example of a simple script and see how it works.

list = ['My', 'Test', 'List', 'To', 'Check', 'ProgressBar']

for i in list:
    # Do Something here

print('Done!')

Output:

Done!

Now let’s put this in

from progressbar import ProgressBar

progbar = ProgressBar()

list = ['My', 'Test', 'List', 'To', 'Check', 'ProgressBar']

for i in progbar(list):
    # Do Something here

print('Done!')

Output:

100% |####################################################################################################################################################################|
Done!

You can find more information about ProgressBar here.

Python Add Progress Bar

No Comments

Post a Comment

Time limit is exhausted. Please reload CAPTCHA.