Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

clear console python

import sys
import os

if os.name == 'nt':
	os.system('cls')
else:
	os.system('clear')
    
# the reason i used "if os.name == 'nt'" is because the operating system "nt"
# is windows, and windows can only use the command "cls" to clear the
# console, if a linux user is using your program then it'll throw an error
# because only command prompt uses "cls"
Source by www.delftstack.com #
 
PREVIOUS NEXT
Tagged: #clear #console #python
ADD COMMENT
Topic
Name
9+1 =