Pages

Saturday, May 19, 2012

How to clear Python shell


Unfortunately, I don't think there is a way to clear the screen in IDLE. The best you could do is to scroll the screen down lots of lines, eg:
print "\n" * 100
Though you could put this in a function:
def cls(): print "\n" * 100
And then call it when needed as cls().

However, if you are using the command line, you can use the following to clear the command line.
import os
os.system("cls")

No comments:

Post a Comment