如何“回车”同时有两条或多条线?

发布于 2025-01-12 10:49:39 字数 445 浏览 3 评论 0原文

print("Z1: ",zeta_1_time," Z2: ",zeta_2_time," Z3",zeta_3_time,end="\r")
print()
print("GAMMA: ",gamma_time, end="\r")

正如您从上面的代码中看到的,我无法让回车 \r 正常工作。我需要 ZETA 时间和 GAMMA 时间在同一 while 循环内在自己的线路上“更新”。然而,这是我得到的回报。

输出:

Z1:  9  Z2:  6  Z3:  3
Z1:  0  Z2:  0  Z3:  0
GAMMA:  0

while 循环越长,ZETA 创建的行越多。有什么建议吗?

输出应保持如下所示:

Z1:  9  Z2:  6  Z3:  3
GAMMA:  0
print("Z1: ",zeta_1_time," Z2: ",zeta_2_time," Z3",zeta_3_time,end="\r")
print()
print("GAMMA: ",gamma_time, end="\r")

As you can see from code above, I am having trouble getting carriage \r to function properly. I need both the ZETA times and the GAMMA times to be "updating" on their own line, within the same while loop. However, this is the output I am getting in return.

OUTPUT:

Z1:  9  Z2:  6  Z3:  3
Z1:  0  Z2:  0  Z3:  0
GAMMA:  0

The longer the while loop, the more lines ZETA creates. Any suggestions?

The output should stay looking like this:

Z1:  9  Z2:  6  Z3:  3
GAMMA:  0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文