screen clear question
Alan Gauld
alan.gauld at btinternet.com
Sun Jan 2 03:43:52 EST 2005
On Sun, 02 Jan 2005 14:23:07 +0800, Craig Ringer
<craig at postnewspapers.com.au> wrote:
> On Sun, 2005-01-02 at 11:31, jcollins wrote:
> > Is there a command in Python to clear the screen? That is without writing
> > multiple blank lines.
>
> Without knowing what 'screen' you're talking about, it's hard to say. If
> you mean clearing a terminal, you can call 'tput clear' or
> '/usr/bin/clear' on many UNIX systems; no idea about Windows.
On Windows the DOS CLS command will clear a command prompt, it
also works for CP/M and VAX terminals too. Finally I think the
curses module allows you to clear a window, including the main
window - ie the terminal screen.
In each case run CLS (or clear) via os.system()
But the bottom line is that there is no builtin command
because the mechanism is different on each platform.
Alan G.
Author of the Learn to Program website
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Python-list
mailing list