Here are three top commands you need to clear screen in Python. And, I have posted a Video how to use these commands. Even though Python is installed on Linux, the “CLEAR” command will not work in Python console.
IN THIS PAGE
How to Clear Screen in Python2*.
Using Print
Use print command with \n to clear screen.
>>> print “\n” * 80
Using os.system and “cls”
Use os.system to clear the screen.
>>> import os os.system(“cls”)
Using os.system and “clear”
>>> import os os.system(“clear”)
How to Clear Screen in Python3*.
Here is clear cmd in python 3. In Python 3*, to clear the screen or console you need a special command. The Linux command ‘clear‘ or ‘cls‘ will not work.
You can use two commands to clear the screen in Python.
Video: Python Clear Screen
Using Print
>>> print(“\n” * 80)
Using Import Os
>>> import os
>>> os.system(‘clear’)
Related Posts