numpy - Python Terminal Text Output Formating -


i have python program outputs few numpy matricies , other information terminal in fashion: terminal output

currently, view data, follow order:

  1. print data
  2. clear screen
  3. 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

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -