标签:pre sleep time int port pytho ota for 进度
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import sys
import time
def bar(num, total):
rate = num / total
rate_num = int(rate * 100)
r = ‘\r[%s%s]%d%%‘ % ("="*num, " "*(100-num), rate_num)
sys.stdout.write(r)
sys.stdout.flush()
if __name__ == ‘__main__‘:
for i in range(0, 101):
time.sleep(0.1)
bar(i, 100)
标签:pre sleep time int port pytho ota for 进度
原文地址:https://www.cnblogs.com/NiceTime/p/10082229.html