clear python console command line code example
Example 1: python clear console
import sys, os
os.system('cls')
Example 2: console clear python
import os
os.system('clear')
Example 3: clear window python console
import os
clear = lambda: os.system('cls')
Example 4: python clear console
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()