We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2306545 commit fff8b85Copy full SHA for fff8b85
flush-print/progress.py
@@ -2,18 +2,10 @@
2
3
4
def progress(percent=0, width=30):
5
- left = width * percent // 100
6
- right = width - left
7
- print(
8
- "\r[",
9
- "#" * left,
10
- " " * right,
11
- "]",
12
- f" {percent:.0f}%",
13
- sep="",
14
- end="",
15
- flush=True,
16
- )
+ progress = (width * percent // 100)
+ bar = "#" * progress
+ pad = " " * (width - progress)
+ print(f"\r[{bar}{pad}] {percent:.0f}%", end="", flush=True)
17
18
19
for i in range(101):
0 commit comments