Clear screen

seb seb at tesco.net
Mon Nov 26 19:46:23 EST 2001


On 25 Nov 2001 09:22:11 -0800, rune at nesheim.net (Rune Nesheim) wrote:

>"Christian Fuhrmann" <C.Fuhrmann at gmx.de> wrote in message news:<9tqlu7$47pu5$1 at ID-110600.news.dfncis.de>...
>> Hi!
>> How do I Clear the screen in the normal line-commanded window. (In C/C++ I
>> say cls();)
>> Chris
>> (C.Fuhrmann at gmx.de)
>
>
>Import the os module and then you can use the system function you
>would normaly use to clear the screen in your os.
>In linux:
>
>import os
>os.system('clear')
>
>In dos/windows:
>
>import os
>os.system('cls')

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?

seb.





More information about the Python-list mailing list