2006/1/23, Suri Chitti <[EMAIL PROTECTED]>:
>
> Dear group,
>            If I am executing a python prog from the command line and
> need to clear the screen (like using the cls command at the windows cmd
> prompt) midway into the program, how do I do it??  Any inputs will be
> greatly appreciated.
> Thanks.
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>

Hi there
A nice neat trick which is:

print '\n' * 100

Will print a hundred lines on the screen,thus shifting the cursor down
so the screen will seem to have been cleaned.

Or it's possible to implement these lines in a program:

 import os, platform
 def clear_screen():
  if platform.system() == 'Linux': os.system('clear')
  if platform.system() == 'Windows': os.system('cls')
 clear_screen()

(Both them are excerpt from the Python Tips and Tricks published from
the Italian Python User Group).
Cheers
Ivan
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to