I'm already aware of using \b and \r to move back one character and to the beginning on the line respectively. But is there a way, (specifically in python,) to move the cursor position up 1 line? I'm trying to avoid using curses, but if this is the best option then so be it.
+1
A:
The cuu1
capability will give you the sequence you need in order to do so.
echo -e "aa\n$(tput cuu1)b"
Ignacio Vazquez-Abrams
2010-10-29 20:22:29
Interesting, but I was honestly hoping to accomplish this without calling an external program. If nothing better comes along I'll do this though!
OmnipotentEntity
2010-10-29 21:00:12
`curses.tigetstr('cuu1')`
Ignacio Vazquez-Abrams
2010-10-29 21:01:51
I assume that I'll need to use curses then and there's no getting around it... :)
OmnipotentEntity
2010-10-29 21:21:06
@OmnipotentEntity: It's not recommended that you hardcode terminal control sequences, but this may be of interest to you: Of the over 1500 terminfo terminal description files on my system, over 700 use `Esc[A` for `cuu1`, 230 use VT (`0x0B`), 181 don't have it, and 176 use `EscA`. The others use over 30 other sequences.
Dennis Williamson
2010-10-30 01:45:19