标签:python rate float bsp test ota sleep temp name
import time
def bar(num=1, total=100):
rate = float(num) / float(total)
rate_num = int(rate * 100)
temp = ‘\r%d %%‘ % (rate_num, )
sys.stdout.write(temp)
sys.stdout.flush()
def test():
i = 0
while True:
i += 1
time.sleep(0.1)
bar(i, 100)
if i == 100:
break
if __name__ == ‘__main__‘:
test()
标签:python rate float bsp test ota sleep temp name
原文地址:https://www.cnblogs.com/dongmengze/p/9618464.html