cls

greg andruk meowing at banet.net
Sat May 22 02:01:51 EDT 1999


Charles G Waldman <cgw at fnal.gov> writes:

> Marek Polanski writes:
>> ok. I have really lame question, but problem is killing me, and I 
>> cannot find solution. I need equivalent of 'cls' command in python. 
>> TIA for help.

> It depends on the type of system you're running on, and the type of
> terminal emulator.  For anything which supports VT100-type commands
> (this includes most terminal emulators!) you can use

> print chr(27)+"[2J"

Add a chr(27)+'[H' if you want to make sure the cursor is homed.

To make these k0dez work on DOS/Win systems, it's necessary to load in
the hoary old ANSI.SYS driver.

It's probably less hassle, though, to just use os.system() with 'cls'
or 'clear' or whatever the target system has.  Or go to curses and do
it properly.

Speaking of curses, has anyone already made a wrapper for the S-Lang
display stuff?
-- 
Misc. Meowing: <URL:http://members.xoom.com/meowing/> **meow**




More information about the Python-list mailing list