5

So i have a function that takes a lot of time to finish i want to know how to make progress bar for the function, the code looks like this

def some_function():
    #do something
    #do something
    #do something
    print('finished')

output

[==========         ] 40%
[==============     ] 60%
[=================  ] 80%
finished
[===================] 100%

it will be good if it's update in the same place

Ali Faki
  • 3,928
  • 3
  • 17
  • 25
  • 4
    See http://stackoverflow.com/questions/3173320/text-progress-bar-in-the-console – HelloWorld Aug 23 '15 at 22:50
  • 1
    First you need to figure out how to measure the progress of whatever your function is doing and come up with a representation for it. To update in place you can look at this question: http://stackoverflow.com/questions/60221/how-to-animate-the-command-line . There is also a progress bar library you can study for inspiration (or just use it, if it suits you): https://code.google.com/p/python-progressbar/source/browse/ – Paulo Almeida Aug 23 '15 at 23:06

0 Answers0