remove last STDOUT line in Python

后端 未结 5 747
温柔的废话
温柔的废话 2020-11-28 11:17

I am trying to figure out how to suppress the display of user input on stdout.

raw_input() followed by any print statement preserves what the user typed

5条回答
  •  清酒与你
    2020-11-28 11:34

    You might be able to do what you want with VT100 control codes.

    Something like this maybe:

    CURSOR_UP_ONE = '\x1b[1A'
    ERASE_LINE = '\x1b[2K'
    print(CURSOR_UP_ONE + ERASE_LINE)
    

提交回复
热议问题