Clear screen

Cliff Wells logiplexsoftware at earthlink.net
Mon Nov 26 19:59:18 EST 2001


On Monday 26 November 2001 16:46, seb wrote:

> If you wanted to make it generic (not that i want to), would os.name
> clarify this:
>
> if os.name == 'NT':
> 	os.system('cls')
>
> or is this a Bad Thing?

How about something like:

import sys

if sys.platform == 'linux2':
    CLEAR_SCREEN = "clear"
elif sys.platform =='win32':  # or whatever this is 
    CLEAR_SCREEN = "cls"

os.system(CLEAR_SCREEN)

This way you avoid a test everytime you want to clear the screen.

-- 
Cliff Wells
Software Engineer
Logiplex Corporation (www.logiplex.net)
(503) 978-6726 x308
(800) 735-0555 x308




More information about the Python-list mailing list