- Notifications
You must be signed in to change notification settings - Fork 638
Expand file tree
/
Copy pathP70_SimpleProgressBar.py
More file actions
Latest commit
18 lines (13 loc) · 591 Bytes
/
Copy pathP70_SimpleProgressBar.py
File metadata and controls
18 lines (13 loc) · 591 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# This is the program for creating a simple progress bar. You may need this in many of your projects.
# You can install a module for progress bar by 'pip3 install progressbar2'
importsys, time
defprogressBar(count, total, suffix=''):
barLength=60
filledLength=int(round(barLength*count/float(total)))
percent=round(100.0*count/float(total), 1)
bar='='*filledLength+'-'* (barLength-filledLength)
sys.stdout.write('[%s] %s%s ...%s\r'% (bar, percent, '%', suffix))
sys.stdout.flush()
foriinrange(10):
time.sleep(1)
progressBar(i, 10)