How to refresh the multi-line output dynamically
Question: I want to refresh some info dynamically(just like progress bar), I can do it
with following code

    
    
    #! /usr/bin/env python
    import sys
    import time
    
    print "start the output"
    def loop():
        i = 0
    
        while 1:
            i += 1
            output = "\rFirst_line%s..." % str(i) 
            sys.stdout.write(output)        
            sys.stdout.flush()
            time.sleep(1)
    loop()
    

It could only output single_line info dynamically, When add '\n' into output,
It couldn't work as expect.

    
    
    output = "\rFirst_line%s...\n" % str(i)
    

Any way could help it to refresh multi_line content?


Answer: You could do it with [curses](http://docs.python.org/2/library/curses.html),
but it's nontrivial.

