os.system('cls')

Python python at rgbaz.eu
Thu Dec 25 13:17:30 CET 2008


On 25 dec 2008, at 12:56, Dennis van Oosterhout wrote:

> 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')
>
never used it myself either, but from reading the manual
i think you need

import subprocess
subprocess.Open('cls')


what you did is create a function that you need to call to execute it
(and a capital P typo in subprocess)

'clear' is for *nix systems
it won;t work in DOS i think
(I'm don;t have windows here...)


> But it just doesn't seem to work. Would you have any idea how it  
> would work?
>
> Once more thanks for the first answer,
>>

you;re welcome :)



More information about the Python-list mailing list