zoukankan      html  css  js  c++  java
  • 进度条

    
    
    
    
    import time,sys
    for i in range(100):
        sys.stdout.write("L")
        sys.stdout.flush
        time.sleep(0.1)
    
    
    
    import time
    for i in range(0, 101, 2):
      time.sleep(0.3)
      num = i // 2
      if i == 100:
        process = "
    [%3s%%]: |%-50s|
    " % (i, '|' * num)
      else:
        process = "
    [%3s%%]: |%-50s|" % (i, '|' * num)
      print(process, end='', flush=True)
    
    
    
    import time
    def bar(data):
        jd = '
     %2d%% [%s%s]'
        for i in range(data+1):
            a = '~'*1
            b = '*'*(data-i)
            c = (i / data) * 100
            print(jd % (c,a,b),end='')
            time.sleep(0.5)
    bar(50)

    import time
    
    def func(size,total_size):
        val = int(size / total_size * 100)  #*100  代表百分之
        print("
    %s%%|%s"%(val,"#" * val),end='')
    
    for i in range(101):
        time.sleep(0.2)
        func(i,101)
    
    

     for循环打印

    自制进度条
    import time
    for i in range(101):
    time.sleep(0.2)
    a = "%s%%"%i  #双百分号代表一个百分号
    b = "#" * i
    c = {a:b}
    print(' %s'%c,end='')
    
    
    
    
    import time
    for i in range(101):
    time.sleep(0.2)
    a = "%s"%i
    print(" %s%%|%s"%(a,"_+"*i),end='')
     

     

  • 相关阅读:
    nodejs websocket
    [Java] 数组-01 入门
    [Java] 第一,二章 配置, 基础
    [Java] 第四章 异常机制
    [Java] 第三章 面向对象总结
    [Java] 接口-02
    [Java] 接口-01
    [Java] final 关键字
    [Java] 抽象类
    [Java] 多态-01
  • 原文地址:https://www.cnblogs.com/nice777/p/10923325.html
Copyright © 2011-2022 走看看