[Tutor] CLS? (Joseph Quigley)

Alan Gauld alan.gauld at freenet.co.uk
Sat Apr 23 01:28:19 CEST 2005


> In QBASIC there was the command "CLS"
> this wiped the screen and "started printing letters to the screen at
the
> top " of the console window.

This was possible because QBASIC knew what kind of screen it was
working with, Python can't tell that reliably since it runs on
many operating systems.

The best way is probably to use the os.system() call to clear the
screen via the OS. Thus on DOS its

os.system('CLS')

on Linux

os.system('clear')

Failing that you can write a cls function:

def cls():
   print '\n' * 100

HTH,

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list