문제

I'm struggling a little with curses module in Python. I'm trying to get it to show this constantly updating statement (in a loop):

print(i/(time.time()-start_time))

on one line rather than multiple lines. What's the easiest way?

도움이 되었습니까?

해결책

Probably you can use something like this. You just have to adjust it for your needs.

import curses
import time

scr = curses.initscr()
while True:
    try:
        scr.addstr(0, 0, str(time.time()))
        scr.refresh()
    except KeyboardInterrupt: break
curses.endwin()
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top