os.system('cls')

Dennis van Oosterhout de.slotenzwemmer at gmail.com
Thu Dec 25 06:56:34 EST 2008


Hello Arno,

thanks for the explanation! I have one more question: on the python
site it says it's better to replace the system commands by subprocess
and Popen.
Now I searched for some good example for my specific case (as I have
no idea how it should work and I don't get it any clearer by reading
http://docs.python.org/3.0/library/subprocess.html#module-subprocess)
and I found this:

> import subprocess
> def clear():
>     subProcess.Popen('clear')

But it just doesn't seem to work. Would you have any idea how it would work?

Once more thanks for the first answer,

Devilly


2008/12/25 Python <python at rgbaz.eu>
>
> On 25 dec 2008, at 11:22, Dennis van Oosterhout wrote:
>
>> Hi there! I was searching for a way to clear the 'DOS screen'/command screen etc. and found that os.system('cls') works for this. I was just wondering where I can find al the commands which can be used for os.system(). I searched with google but I didn't find an answer. In the official python tutorial it says os.system('command') executes the command, but it doesn't say which commands exist (or I'm just blind).
>>
>> Does anyone have an answer for this question?
>>
>> Thanks,
>>
>> Devilly
>
> Hey Deville,
>
>
> os.system() executes commands that you usually use in a shell outside python.
> so in the case of you being a windows user, you replace 'command' with any DOS
> command.
>
> gr
> Arno



More information about the Python-list mailing list