On Sat, Sep 22, 2012 at 2:50 AM, Ismael Farfán <sulfur...@gmail.com> wrote: > 2012/9/21 Peter Otten <__pete...@web.de>: >> echo.hp...@gmail.com wrote: >> >> print "\x1b[2J\x1b[0;0H" # optional > > Nice code : ) > > Could you dissect that weird string for us? > > It isn't returning the cursor to (0,0), it's just like executing > clear(1), and looks like those line coloring scape sequences for bash.
It's an ANSI escape sequence, or rather two of them. The first one clears the screen, the second returns you to 0,0. (Isn't that implicit in the 2J code? Maybe I'm misremembering.) But it depends on the terminal responding to them, and not all terminals do. For instance, most MUD clients parse only a very small subset of ANSI codes, eg color codes only. ChrisA -- http://mail.python.org/mailman/listinfo/python-list