爬虫进度条设置代码

import sys
import time

sys.stdout.flush()

i = 0
for i in range(20):
    time.sleep(1)
    sys.stdout.write("\r# Process: %0.1f %%" % (float(i + 1) / float(20) * 100))
    sys.stdout.flush()


import time
i = 0
for i in range(20):
    time.sleep(1)
    print("\r# Process: %0.1f %%" % (float(i + 1) / float(20) * 100),end="")

你可能感兴趣的:(爬虫进度条设置代码)