numpy - Python Terminal Text Output Formating -
i have python program outputs few numpy matricies , other information terminal in fashion:
currently, view data, follow order:
- print data
- clear screen
- re print (and repeat)
however, inefficient. able see numbers changing program runs, without overhead of screen clearing. there way can format output using native python won't have to expensive operation? idea can have works htop (or similar formatted terminal programs, such cmus).
thanks!
why clearing screen such expense? terminal has, likely, buffer of fixed size overwritten older lines "scroll up". rewriting output may take few ms (or more, depends on how big is). if output massive, consider different approach, e.g. slice matrices , output changed or use plot inspect data (hint: matrices can displayed images). if need "fixed" display on terminal, curses
module way go, output cannot big, otherwise not fit terminal window anyway. if need implement scrolling, consider moving graphical user interface.
Comments
Post a Comment