python3.6 print同一行覆盖打印

1.python3.6中 print同一行覆盖打印可以这样使用

通用:
print("\r",object,end="",flush=True)

例子:
print("\r"+"loss_G:{:0.3f}".format(loss_G.item()),end = "",flush=True)

注意:不能同时print两条都覆盖打印,这样无效。

参考:

1.https://www.zhihu.com/question/21100416(风骨666的评论)

你可能感兴趣的:(python3.6 print同一行覆盖打印)