利用print函数模拟打印进度条
2024-09-05 19:28:45
import time
for i in range(, , ):
time.sleep(0.1)
num = i // 2 # 地板除,即取不大于/后的最小整数(3//2 = 1, 9//4 = 2, -7//2 = -4)
s_str = '\r{}% : {}\n'.format(i, '*' * num) if i == else '\r{}% : {}'.format(i, '*' * num) # \r表示每次光标都会移到行首,非换行
print(s_str, end='', flush=True) # end=''指定每次print的结束符为空,默认是\n为换行
逐步显示直到显示100% : **************************************************
最新文章
- ubuntu下安装chrome
- Portal 设置
- 实践一:Linux基础实践
- 招聘一个靠谱的iOS》面试题参考答案(上)
- 关于 profile文件(转)
- 【暴力,STL,水】UVa 1523 - Helicopter
- 什么是Zookeeper,Zookeeper的作用是什么,在Hadoop及hbase中具体作用是什么
- spring mvc 笔记
- c#基础语言编程-正则表达式基础
- AFNetworking GET和POST请求
- Webserver管理系列:5、利用MSConfig排查木马
- 探讨弹性布局Flexible Box
- [原创]K8Cscan插件之存活主机扫描
- Confluence 6 那些文件需要备份
- 容器101:Docker基础
- options.html:1 Refused to load the script 'xxxx' because it violates the following Content Security Policy directive: ";script-src 'self' blob: filesystem: chrome-extension-resource:";.
- LeetCode题解之Convert Sorted List to Binary Search Tree
- UIAlertView/UIAlertController封装使用
- ElasticSearch 深度分页解决方案 {";index";:{";number_of_replicas";:0}}
- 【liunx】端口号的占用情况查看