Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

is there a python command that clears the output

# import only system from os
from os import system, name
  
# import sleep to show output for some time period
from time import sleep
  
# define our clear function
def clear():
  
    # for windows
    if name == 'nt':
        _ = system('cls')
  
    # for mac and linux(here, os.name is 'posix')
    else:
        _ = system('clear')
  
# print out some text
print('hello geeks
'*10)
  
# sleep for 2 seconds after printing output
sleep(2)
  
# now call function we defined above
clear()
Comment

PREVIOUS NEXT
Code Example
Python :: split multiple times 
Python :: python r before string 
Python :: numpy multidimensional indexing 
Python :: python little endian to big endian 
Python :: python list flatten 
Python :: from time import sleep, time 
Python :: apply strip() a column in pandas 
Python :: switching versions of python 
Python :: Import "dj_database_url" could not be resolved Pylance 
Python :: kivy window size 
Python :: how to split image dataset into training and test set keras 
Python :: pyqt5 pylatex 
Python :: append to csv python 
Python :: python how to copy a 2d array leaving out last column 
Python :: identify null values 
Python :: python gtts 
Python :: python draw polygon 
Python :: pandas change frequency of datetimeindex 
Python :: python pandas replace nan with null 
Python :: pandas select data conditional 
Python :: get local python api image url 
Python :: how to add 2 dates in python 
Python :: show number as 3 digit python 
Python :: discordpy 
Python :: how to import random module in python 
Python :: replace value column by another if missing pandas 
Python :: convert torch to numpy 
Python :: how to change the color of command prompt in python 
Python :: how to display a manytomany field in django rest framework 
Python :: timed loop python 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =