728x90
반응형
time.sleep 함수와 carriage return을 이용한 간단한 프로그래스바.
import time
l = ["-","/","|","\\"]
t = len(l)
def dp_progressbar():
for i in range(100):
idx = i%t
prog = int(i//10)
print(f"progressing... {l[idx]} : {'='*prog}{i:03d}%",end="\r")
time.sleep(.1)
print(f"progressing... - : {'='*10}100%")
dp_progressbar()

728x90
'Python' 카테고리의 다른 글
| [DL] torch.nn.Linear 에 대하여 (1) | 2025.04.10 |
|---|---|
| [PyTorch] torch.save 와 torch.load - tensor 위주 (0) | 2025.04.08 |
| [OpenCV] macOS에서 Qt 지원하도록 빌드. (0) | 2025.04.05 |
| [Py] collections.ChainMap (0) | 2025.04.04 |
| [Py] collections.namedtuple-Factory Function (0) | 2025.04.04 |