我想知道是否可以删除您用 Python 打印的项目——不是从 Python GUI 中,而是从命令提示符中。例如
a = 0
for x in range (0,3):
a = a + 1
b = ("Loading" + "." * a)
print (a)
所以它打印
>>>Loading
>>>Loading.
>>>Loading..
>>>Loading...
但是,我的问题是我希望这一切都在一条线上,并且当其他事情出现时它会自行删除它。 So instead of printing "Loading", "Loading.", "Loading...
I want it to print "Loading."
, then it removes what is on the line and replaces it with "Loading.."
and then removes "Loading.."
并将其(在同一行)替换为 "Loading..."
。这有点难以描述。
ps 我试过使用 Backspace 字符,但它似乎不起作用( "\b"
)
原文由 Alex 发布,翻译遵循 CC BY-SA 4.0 许可协议
只需使用 CR 即可转到行首。