3 Top Python Commands to Clear Screen

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.


  1. How to Clear Screen in Python2*.
    1. Using Print
    2. Using os.system and “cls”
    3. Using os.system and “clear”
  2. How to Clear Screen in Python3*.
    1. Video: Python Clear Screen
    2. Using Print
    3. Using Import Os

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

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.