[Tutor] Clear Screen
fleet@teachout.org
fleet@teachout.org
Sat, 28 Jul 2001 14:13:22 -0400 (EDT)
Absolutely wonderful! Tutor is my friend! :) I've actually gotten into
the later chapters of "Learning Python" (two more days 'til it goes back
to the library!) and believe I ran across something that told me I could
do that - but hadn't gotten to try it yet. Thanks a million!
- fleet -
PS: This replaced the function in my startup file! :)
>From: "Allan Crooks" <allan.crooks@btinternet.com>
>Date: Fri, 27 Jul 2001 23:10:12 +0100
>
>Hi,
>
>> I was hoping there would be some way to change >>>cls() to simply >>>cls -
>> but this is close enough! :)
>
>It just occured to me how you could do this.
>
>class clear:
>
> def __repr__(self):
> import os, sys
> cls = os.popen("clear").read()
> sys.stdout.write(cls)
> return ""
>
>cls = clear()
>
>Now you can type cls, and it'll run the clear.__repr__ method, which will
in turn clear the screen for you. :)
>
>Allan.