[Tutor] Clear Screen

fleet@teachout.org fleet@teachout.org
Thu, 26 Jul 2001 22:51:59 -0400 (EDT)


>Date: Thu, 26 Jul 2001 18:45:13 +0200
>From: Kalle Svensson <kalle@gnupung.net>
>
>Why eval?  eval() takes a string argument and evaluates it as a python
>expression.  Most often, the output of the system "clear" command isn't a
>valid python expression... <wink>
>My guess is that you really want
>
>def clear():
>    import os, sys
>    cls = os.popen("clear").read()
>    sys.stdout.write(cls)

This works!

>or, perhaps even better
>
>def clear():
>    import os
>    os.system("clear")

This works like *my* clear() function works - leaves two lines at the top
of the screen. ??

>This version can also be called cls without problems.

If I write it as def cls(): why would there be a problem with any version?
I was hoping there would be some way to change >>>cls() to simply >>>cls -
but this is close enough! :)

Thanks all.

>Free Dmitry Sklyarov! - http://www.freedmitry.org/

Right on!

				- fleet -