Welcome, guest | Sign In | My Account | Store | Cart

Clear the screen on unix terminals, uses terminfo.

terminfo inspiration courtesy of http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/475116

Python, 5 lines
1
2
3
4
5
def clear_screen():
    import curses, sys
    curses.setupterm()
    sys.stdout.write(curses.tigetstr("clear"))
    sys.stdout.flush()

1 comment

Jerry Rocteur 11 years, 3 months ago  # | flag

Thans for that. I couldn't find anything portable but this does work on Mac OS X and Linux!