我写一道加载进度条的题目,需要清屏显示进度条加载过程,但是我从网上搜到的用os库的方法没有作用,下面是我的代码和运行结果图片
import time
import os
def progress():
fill="\ "
unfill=""
barlength=int(20)
for i in range(0,barlength+1,1):
os.system('cls')
print("当前下载进度为:"+'\033[32m'+i*fill+'\033[0m'+(barlength-i)*unfill+str(int((i/barlength)*100))+"%")
time.sleep(0.1)
progress()