Skip to content

Instantly share code, notes, and snippets.

@suganoo
Created September 5, 2017 09:05
Show Gist options
  • Save suganoo/2d046ac3271e40e5f24be77d144e2ebf to your computer and use it in GitHub Desktop.
Save suganoo/2d046ac3271e40e5f24be77d144e2ebf to your computer and use it in GitHub Desktop.
プログレスバー使い方
from time import sleep
from tqdm import tqdm
for i in tqdm(range(100)):
sleep(0.1)
from time import sleep
from tqdm import tqdm
pbar = tqdm(total=100)
for i in range(100):
pbar.update(1)
sleep(0.1)
pbar.close()
from time import sleep
from tqdm import tqdm
pbar = tqdm(["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"])
for char in pbar:
pbar.update()
sleep(1)
from time import sleep
from tqdm import tqdm
pbar = tqdm(["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"])
for char in pbar:
pbar.set_description("Processing %s" % char)
sleep(1)
from time import sleep
from tqdm import tqdm
pbar = tqdm(total=100)
# update x 10 times
pbar.update()
sleep(2)
pbar.update()
sleep(2)
pbar.update()
sleep(2)
pbar.update()
sleep(2)
pbar.update()
sleep(2)
pbar.update()
sleep(2)
pbar.update()
sleep(2)
pbar.update()
sleep(2)
pbar.update()
sleep(2)
pbar.update()
# end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment