def progress(prompt, percent, bar_length=20):
hashes = '#' * int(round(percent * bar_length))
spaces = ' ' * (bar_length - len(hashes))
return "\r{}: [{}] {}%".format(
prompt,
hashes + spaces,
int(round(percent * 100)))
#ref: https://docs.python.org/3.5/library/itertools.html#itertools.zip_longest
评论列表
文章目录