zoukankan      html  css  js  c++  java
  • 3 种进度条 -- 记录

    第一种:普通进度条

    # 普通进度条
    
    import sys
    import time
    
    def test():
        for i in range(1, 101):
            print('
    ', end='')
            print('Download progress: {}%'.format(i), '' * (i//2), end='')
            sys.stdout.flush()
            time.sleep(0.05)
    
    test()

    第二种:带时间的进度条

    # 带时间进度条
    
    import time
    
    def test():
        start = time.perf_counter()
        for i in range(60+1):
            a = '*' * i
            b = '.' * (60 - i)
            c = (i / 60) * 100
            dur = time.perf_counter() - start
            print('
    {:^3.0f}%[{} - > {}]{:.2f}s'.format(c, a, b, dur), end='')
            time.sleep(0.1)
    
    test()

    第三种:tqdm进度条

    from tqdm import tqdm
    from time import sleep
    
    for i in tqdm(range(100)):
        sleep(0.1)

  • 相关阅读:
    dfs-入门模板
    dp-状压dp
    c++ sizeof详解
    各种排序算法
    简介
    第178场周赛总结
    单调队列
    2019.10.24刷题统计
    2019.10.23刷题统计
    2019.10.22刷题统计
  • 原文地址:https://www.cnblogs.com/shiyixirui/p/14419970.html
Copyright © 2011-2022 走看看