def clear(): os.system('cls') code example
Example 1: python clear console
import sys, os
os.system('cls')
Example 2: python interpreter clear screen
import os
# Windows
os.system('cls')
# Linux
os.system('clear')
import sys, os
os.system('cls')
import os
# Windows
os.system('cls')
# Linux
os.system('clear')