Hello tutors!

I have the following in my PYTHONSTARTUP file

def clear():
   x = subprocess.Popen("clear").communicate(None)[0]
   return x

so that when I type:
clear()
at the prompt, my terminal screen clears and I get only my prompt at the top
of the screen.

without the index at the end of .communicate() I get a tuple '(None, None)'
before my prompt at the top of the cleared screen. If I call either x[0] or
x[1] the command will return a single None, which is not displayed in the
interpreter but if I leave off the index".communicate(None)"- so that it
returns both  stdout and sterr then
clear() will return a tuple which will be displayed by the interpreter.

Am in correct in my interpretation of the interpreter?
Thanks
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to