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.
Resume Service for Our Blog Readers
We provide Technical (Computer related) Resume service for all experience people.
How to Clear Screen in Python2*.
1: Using Print
Use print command with \n to clear screen.
>>> print “\n” * 80
2: Using os.system and “cls”
Use os.system to clear the screen.
>>> import os os.system(“cls”)
3: Using os.system and “clear”
>>> import os os.system(“clear”)
How to Clear Screen in Python3*.
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.
1. Using Print
>>> print(“\n” * 80)
2.Using Import Os
>>> import os