打印到控制台(无滚动) [英] Printing to console (No Scroll)
问题描述
我怎么能打印到控制台而不用滚动到新行?
每个打印声明?
我想要在控制台中打印一个倒数,但是对于每个计数它会滚动屏幕(当然)
。
还有另外一种方法吗?
这是现在的简单脚本
print" Closing window in:"
for second in range (10):
time.sleep(1)
打印`10秒`+ +秒'
谢谢
/ totte
>如何在没有为每个打印语句滚动到新行的情况下打印到控制台?
我想在控制台中打印倒计时,但是对于每个计数它会滚动<屏幕(当然)。
使用ncurses。
Diez
Totte Karlsson写道:
如何打印到控制台而不必滚动到每个打印语句的新行?<我想在控制台中打印倒计时,但是对于每个计数它都会滚动屏幕(当然)。
还有其他方法吗?
打印关闭窗口:
第二个范围(10):
time.sleep(1)
print`10秒`+秒
感谢
/ totte
这对我有用:
导入时间,sys
范围内的秒数(10):
time.sleep(1)
sys.stdout.write(`10 -second` +" seconds")
sys.stdout.flush()
ncurses的替代品?这似乎是一种矫枉过正......
欢呼
/ totte
" Diez B. Roggisch" <德************ @ web.de>在消息中写道
news:bu ************* @ news.t-online.com ...如何在没有为每个打印语句滚动到新行的情况下打印到控制台?
我想在控制台中打印倒计时,但每次计数都是
滚动屏幕(当然)。
使用ncurses。
Diez
-
http://mail.python.org/mailman/listinfo/python-list
Hi,
How can I print to the console without having it scrolling to a new line for
each print statement?
I want to print a count down in the console, but for each count it scrolls
the screen (of course).
Is there another way?
Here is the simple script for now
print "Closing window in :"
for second in range(10):
time.sleep(1)
print `10-second` +" seconds"
thanks
/totte
> How can I print to the console without having it scrolling to a new linefor each print statement?
I want to print a count down in the console, but for each count it scrolls
the screen (of course).
Use ncurses.
Diez
Totte Karlsson wrote:Hi,
How can I print to the console without having it scrolling to a new line for
each print statement?
I want to print a count down in the console, but for each count it scrolls
the screen (of course).
Is there another way?
Here is the simple script for now
print "Closing window in :"
for second in range(10):
time.sleep(1)
print `10-second` +" seconds"
thanks
/totte
This works for me:
import time, sys
for second in range(10):
time.sleep(1)
sys.stdout.write(`10-second` + " seconds ")
sys.stdout.flush()
Any alternatives to ncurses? It seems like a overkill for this...
cheers
/totte
"Diez B. Roggisch" <de************@web.de> wrote in message
news:bu*************@news.t-online.com...How can I print to the console without having it scrolling to a new line
for each print statement?
I want to print a count down in the console, but for each count it scrolls the screen (of course).
Use ncurses.
Diez
--
http://mail.python.org/mailman/listinfo/python-list
这篇关于打印到控制台(无滚动)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!