Mega Code Archive

 
Categories / Python Tutorial / Buildin Module
 

Uses the system function to clear the screen

import os import sys def printInstructions( clearCommand ):    os.system( clearCommand )   if os.name == "nt" or os.name == "dos":      clearCommand = "cls"    print "You are using a Windows system." elif os.name == "posix":  # UNIX-compatible system    clearCommand = "clear"    print "You are using a UNIX-compatible system." else:    sys.exit( "Unsupported OS" ) printInstructions( clearCommand )