我尝试使用python和格式化字符串更新打印到stdout的行。该行正在打印,但在每一个循环中,它都会在同一行上打印,紧挨着上次打印的更新。在
item = ("{}{}{}{}".format(totalAllScraped,
str(" profiles scraped "),
(len(sortedurls)),
str(" filtered profiles saved.")))
print(item, sep='', end='', flush=True)
我想把这行打印到stdout,循环的每一次迭代,上一行都会被下一行覆盖。在
这就成功了谢谢
下面是一个简单的例子,Python字符串被打印到stdout被替换
上图:
^{pr2}$对于Stdout,随后的2次迭代将其删除并替换为“testing 2”,然后“testing 3”。在
相关问题 更多 >
编程相关推荐