Clearing the screen

Steven D'Aprano steve at REMOVETHIScyber.com.au
Sun Feb 12 01:59:20 EST 2006


On Sat, 11 Feb 2006 22:26:08 -0800, mwt wrote:

> I can't seem to get that to behave properly. It works fine in a python
> shell, like you're demonstrating it, but not as a command in a module.

Would you like to tell us how you are using it and what happens when you
do, or would you like us to guess? Because it works for me, both as a
stand-alone script:

$ cat clear.py
magic = "\x1b[H\x1b[2J"

def clear():
    print magic

if __name__ == "__main__":
    clear()

$ python clear.py


and also from inside Python as a module:

>>> import clear
>>> clear.clear()




-- 
Steven.




More information about the Python-list mailing list