Python控制台应用程序 - 在输入行上方输出

Sea*_*son 9 python curses console input output

我试图在Python3中编写一个控制台应用程序.

问题是我希望所有输出消息EG:print("Status message")位于底部的输入行之上.

Status message 1
Status message 2
Status message 3
Console:> I want to type here while the output messages displayed
Run Code Online (Sandbox Code Playgroud)

此刻它看起来更像是这样

Console:>  want to type here while the outStatus message 1
put messages displayed
Run Code Online (Sandbox Code Playgroud)

反正有没有使用诅咒吗?

FJD*_*JDU 3

尝试这个:

print chr(27)+'[2AOutput'
Run Code Online (Sandbox Code Playgroud)

希望这就是您所要求的。

抱歉,以上内容适用于 Python 2.7。我不确定Python 3版本是否

print(chr(27)+'[2AOutput')
Run Code Online (Sandbox Code Playgroud)

是否有效。

参考: http: //en.wikipedia.org/wiki/ANSI_escape_code