I am trying to write a console application in Python3.
The problem is I would like all output messages EG: print("Status message") to be above the input line at the bottom.
Status message 1
Status message 2
Status message 3
Console:> I want to type here while the output messages displayed
at the moment it looks more like this
Console:> want to type here while the outStatus message 1
put messages displayed
Is there anyway to do this without using curses?
Try this:
print chr(27)+'[2AOutput'
Hope this is what you are asking for.
Sorry the above is for Python 2.7. I am not sure whether the Python 3 version
print(chr(27)+'[2AOutput')
will work or not.
来源:https://stackoverflow.com/questions/14300245/python-console-application-output-above-input-line