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

<pre><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()
</code></pre>

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

<pre><code>output = "\rFirst_line%s...\n" % str(i)
</code></pre>

<p>Any way could help it to  refresh multi_line content?</p>
