python实现进度条 实现一行输出,只有数字在变 转义字符\r回到行首 import time num = 100 ok_num = 0 while True: ok_num += 1 time.sleep(1) print("\r已经完成%.2f %%"%(ok_num*100/num),end='') if ok_num >= num: break 输出: 已经完成100.00 %