python实现进度条

简介: import time, sysdef process(num, total): rate = num / total ratenum = int(round(rate, 2) * 100) bar = '\r%s%% [%...
import time, sys

def process(num, total):
    rate = num / total
    ratenum = int(round(rate, 2) * 100)
    bar = '\r%s%% [%s%s]' %(ratenum, '#'*ratenum, ' '*(100 - ratenum))
    sys.stdout.write(bar)
    sys.stdout.flush()

n = 80
for i in range(1, n+1):
    time.sleep(0.1)
    process(i, n)
相关文章
|
5月前
|
算法 定位技术 C语言
【python实操】软件安装进展提示进度条如何实现的?如何设置窗体拉伸?如何获取输入框内容?
【python实操】软件安装进展提示进度条如何实现的?如何设置窗体拉伸?如何获取输入框内容?
85 0
|
20天前
|
Linux UED iOS开发
Python中的自定义进度条:从零开始
Python中的自定义进度条:从零开始
|
5月前
|
数据可视化 Python
六种酷炫Python运行进度条
六种酷炫Python运行进度条
|
19天前
|
UED Python
Python requests库下载文件时展示进度条的实现方法
以上就是使用Python `requests`库下载文件时展示进度条的一种实现方法,它不仅简洁易懂,而且在实际应用中非常实用。
35 0
|
2月前
|
数据可视化 Python
用Python给代码安个进度条,太香了吧
用Python给代码安个进度条,太香了吧
48 4
用Python给代码安个进度条,太香了吧
|
2月前
|
Python
Python打印动态进度条
Python打印动态进度条
|
2月前
|
Python
在Python中妥善使用进度条
在Python中妥善使用进度条
|
2月前
|
数据处理 UED Python
Python 进度条:告别枯燥等待,让你的程序动感十足!
Python 进度条:告别枯燥等待,让你的程序动感十足!
74 1
|
2月前
|
监控 API Python
Python中关于进度条的6个实用技巧
Python中关于进度条的6个实用技巧
|
2月前
|
Python
Python 进度条 tqdm模块
Python 进度条 tqdm模块
19 0