[python] import curses

    python 中,我们使用 curses.wrapper 来创建终端交互window。使用 stdscr 来代表 window 对象。

    使用方法:

from curses import wrapper

def main(stdscr):
    # Clear screen
    stdscr.clear()

    # This raises ZeroDivisionError when i == 10.
    for i in range(0, 11):
        v = i-10
        stdscr.addstr(i, 0, '10 divided by {} is {}'.format(v, 10/v))

    stdscr.refresh()
    stdscr.getkey()

wrapper(main)
原文地址:https://www.cnblogs.com/danjawwi/p/6093164.html