[Tutor] subprocess.Popen.communicate()[]

Alan Gauld alan.gauld at btinternet.com
Thu Dec 28 11:18:24 CET 2006


"Isaac" <hyperneato at gmail.com> wrote in 
> I have the following in my PYTHONSTARTUP file
> 
> def clear():
>    x = subprocess.Popen("clear").communicate(None)[0]
>    return x
> 
> Am in correct in my interpretation of the interpreter?

Yes, but can't you simplify this to just:


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

if all you want to do is clear the screen...


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



More information about the Tutor mailing list