不得不吐槽一下,搜索python、print、end="\r"、不能打印任何信息這幾個關鍵詞,搜索到的都是flush設置爲True什麼的,同質化太嚴重了
- print
這個問題一直困擾着我,設置end="\r"後,不能打印任何東西,最後參照:
Python3: print(somestring,end=’\r’, flush=True) shows nothing
如下編寫代碼即可
print("\r", end='')
print('[{%d}/{%d}.F:{%d}] progress image: %s.'%(index, len(images_name), sum_failed, image_name), flush=True, end="")