how to do draw pattern with python?
Ian Kelly
ian.g.kelly at gmail.com
Fri Sep 21 13:32:20 EDT 2012
On Fri, Sep 21, 2012 at 10:50 AM, Ismael Farfán <sulfurfff at gmail.com> wrote:
> 2012/9/21 Peter Otten <__peter__ at web.de>:
>> echo.hping at 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.
They're called "ANSI escape codes". :-)
CSI 2J clears the screen.
CSI 0;0H means "move the cursor to row 0, column 0". However, I don't
think that's valid ANSI, as the coordinates are 1-based. Probably it
should have been "\x1b[2J\x1b[1;1H".
More information about the Python-list
mailing list