clear console python problem code example
Example 1: console clear python
import os
os.system('clear')
Example 2: how to clear the console python
def clear():
# for windows
if name == 'nt':
_ = system('cls')
# for mac and linux(here, os.name is 'posix')
else:
_ = system('clear')
Example 3: python interpreter clear screen
import os
# Windows
os.system('cls')
# Linux
os.system('clear')