Created
May 20, 2019 13:07
-
-
Save edgesider/8dcf3001c452396838c81e5293c32269 to your computer and use it in GitHub Desktop.
python cli progress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
def print_progress(completed, length=20, cell='█', empty='░', begin='', end=''): | |
completed = int(completed) | |
completed = length if completed > length else completed | |
print(begin + cell * completed + empty * (length-completed) + end, end='') | |
for i in range(51): | |
print('\r', end='') | |
print_progress(i, 50, cell='=', empty=' ', begin='[', end=']') | |
time.sleep(0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment