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月前
|
UED Python
Python requests库下载文件时展示进度条的实现方法
以上就是使用Python `requests`库下载文件时展示进度条的一种实现方法,它不仅简洁易懂,而且在实际应用中非常实用。
203 1
|
5月前
|
Linux UED iOS开发
Python中的自定义进度条:从零开始
Python中的自定义进度条:从零开始
|
6月前
|
Python
Python打印动态进度条
Python打印动态进度条
|
6月前
|
监控 API Python
Python中关于进度条的6个实用技巧
Python中关于进度条的6个实用技巧
103 0
|
6月前
|
Python
在Python中妥善使用进度条
在Python中妥善使用进度条
62 1
|
6月前
|
Python
Python 进度条 tqdm模块
Python 进度条 tqdm模块
45 0
|
6月前
|
数据处理 UED Python
Python 进度条:告别枯燥等待,让你的程序动感十足!
Python 进度条:告别枯燥等待,让你的程序动感十足!
176 1
|
6月前
|
数据可视化 Python
用Python给代码安个进度条,太香了吧
用Python给代码安个进度条,太香了吧
69 4
|
7月前
|
UED Python
tqdm进度条函数使用 python
tqdm进度条函数使用 python
|
8月前
|
Python
Python GUI进度条
Python GUI进度条

热门文章

最新文章

推荐镜像

更多