问题 Programs such as vim , top , or alsamixer output multiple lines of text and somehow manipulate lines of text that have already been written. I know about writing the \r character to stdout, which returns the cursor to the start of the line, allowing overwriting of the current line, but not any lines before that. What are these programs doing to have these more advanced UIs with fancy terminal manipulation? In my case I'm looking for a Python solution, but any general information would be