蟒蛇打印一行相同的空间 [英] python print one line same space

查看:76
本文介绍了蟒蛇打印一行相同的空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在同一位置打印确定".有什么办法吗?

I need to print 'ok' in same place. Any ways to do it?

我找到了解决方案,但是它们不能正确用于IDLE:

I've found solutions but they don't works with IDLE correctly:

 while (count < 9):
      if statusm == "<Status>OK</Status>":
         print "ok", 

我希望所有确定"都在同一行上.谢谢!

I want every 'ok' on the same line. Thanks!

推荐答案

例如,如果要在完全相同的位置打印确定",则可以执行以下操作:

For example, if you want to print "OK" in the exact same spot, you can do :

for i in range(0, 10000):
    print("\rOK", end='')

结果:

OK

在同一个控制台点上输入10000次.

worte 10000 times on the same console spot.

这篇关于蟒蛇打印一行相同的空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆