I want to use the Python Module Progressbar.
In my case I want to search for a word in a large list. This works. So I thought a progressbar would be nice. I imported the module and tried it out:
path = str(raw_input(PATH))
word = str(raw_input(WORD))
widgets = ['Suche Wort: ', pb.Percentage(), ' ',
pb.Bar(marker=pb.RotatingMarker()), ' ', pb.ETA()]
timer = pb.ProgressBar(widgets=widgets, maxval=10).start()
loc = -1
with open(path) as f:
for n in range(0,10):
timer.update(n)
for i, line in enumerate(f):
if word in line:
timer.update(n)
loc = i
break
timer.finish()
But there's a problem.. the progressbar stops at 0%.When the whole loop is finished it jumps to 100%. Why?! I don't understand it.
Thank you in advance :)!