import os  def clearConsole():     command = 'clear'     if os.name in ('nt', 'dos'):  # If Machine is running on Windows, use cls         command = 'cls'     os.system(command)  clearConsole() 

Read more of this post