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

    shell进度条

    #!/bin/sh
    b=''
    for ((i=0;$i<=100;i+=2))
    do
            printf "progress:[%-50s]%d%%
    " $b $i
            sleep 0.1
            b=#$b
    done
    echo
    

    效果:

    python进度条

    import time
    def make_progress(percent,width=50):
        if percent > 1:percent=1
        show_str=('[%%-%ds]' % width) % (int(percent * width) * '#')
        print('
    %s %s%%' %(show_str,int(percent * 100)),end='')
    total_size=25555
    recv_size=0
    while recv_size < total_size:
        time.sleep(0.1)
        recv_size+=1024
        percent=recv_size / total_size
        make_progress(percent)
    

    效果:

  • 相关阅读:
    JUC并发工具包之Semaphore
    Linux命令
    uWSGI
    数据库 MySQL 练习
    c++
    c++ 初阶
    Git
    MySQl 和 Redis
    MySQL 查询
    MySQL 命令
  • 原文地址:https://www.cnblogs.com/lvhanzhi/p/10712355.html
Copyright © 2011-2022 走看看