[Tutor] Is there a function for refreshing what's in the console?
Danny Yoo
dyoo@hkn.eecs.berkeley.edu
Sun, 9 Jun 2002 00:44:24 -0700 (PDT)
On Sat, 8 Jun 2002, Dimitrije Nikic wrote:
> Is there a function for refreshing what's in the console? (Eg. delete
> everything printed previously in the window)
There's the silly answer of:
###
for i in range(80):
print
###
*grin* But you're probably thinking something more on the lines of
clearing the whole screen, and having the cursor at the top. For that, if
you're running Windows, try:
###
import os
os.system('cls')
###
If you're running a Unix:
###
import os
os.system('clear')
###
As you can tell, the problem is that it's somewhat system dependent, and I
don't think anyone's written a nice module that hides this dependency yet.
Hope this helps!