Skip to content

Instantly share code, notes, and snippets.

@p208p2002
Created December 24, 2019 00:30
Show Gist options
  • Save p208p2002/e7f16f9bece4475b49878b5e3cd71707 to your computer and use it in GitHub Desktop.
Save p208p2002/e7f16f9bece4475b49878b5e3cd71707 to your computer and use it in GitHub Desktop.
import time
import progressbar
print('in range')
for i in progressbar.progressbar(range(20)):
time.sleep(0.02)
print('in list')
my_list = [1]*100
with progressbar.ProgressBar(max_value=len(my_list)) as bar:
for i,l in enumerate(my_list):
time.sleep(0.1)
bar.update(i)
print('unknow len')
bar = progressbar.ProgressBar(max_value=progressbar.UnknownLength)
for i in range(20):
time.sleep(0.1)
bar.update(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment