Move console cursor up
<p>I tried to create a simple clock up the top-left corner of the screen, updating every second:</p>

<pre><code>def clock():
    threading.Timer(1.0, clock).start()
    print('\033[0;0H' + time.asctime(time.localtime()))
</code></pre>

<p>I've used threading and the colorama module, but it seems the escape code just move the cursor the number of pixels specified, and not to the position.</p>

<hr>

<p>How can I move the cursor to the position <code>(0, 0)</code>?</p>

<p>The line and column start at 1 not 0.</p>

<pre><code>print('\033[1;1H' + time.asctime(time.localtime()))
</code></pre>

<p>or shorter</p>

<pre><code>print('\033[H' + time.asctime(time.localtime()))
</code></pre>

<p>You might also need to save and restore position using ESC-7 and ESC-8.</p>

<p>See <a href="http://ascii-table.com/ansi-escape-sequences-vt-100.php" rel="nofollow">http://ascii-table.com/ansi-escape-sequences-vt-100.php</a> for a list of codes.</p>

<p>Barry</p>

python shell printing console cursor