[Tutor] Clearing the Console Screen

Alan G alan.gauld at freenet.co.uk
Thu Jun 16 23:09:31 CEST 2005


> I haven't found the correct way to do this so far.  

There is no correct way. Every console is different so you have 
to adapt.
That having been said Fred Lundh has written a console module 
that tries to hide the diffeent trminal types in a common set 
of commands - you can download it from his site.

The other ways are:

Unix/LInux/MacOS/BSD:

os.system('clear')

DOS/Windows console:

os.system('CLS')

Generic:

print '\n' * 100 # a 100 line screen...

Or you could find the control codes for your screen
and print them as octal character codes...

HTH,

Alan G.


More information about the Tutor mailing list