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

Isaac hyperneato at gmail.com
Fri Dec 29 08:42:55 CET 2006


> "Isaac"
> > I have the following in my PYTHONSTARTUP file
> >
> > def clear():
> >    x = subprocess.Popen("clear").communicate(None)[0]
> >    return x
> >
>
> 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...
>

Yes, but this way the screen more unix like after calling the
function- it is cleared and only my prompt is shown at the top of the
screen; which is currently ' python > '
Without communicate()[0] the screen is blank and no prompt.
Thanks for your reply.


More information about the Tutor mailing list