Python: 3 Top Commands How to Clear Screen

I have explained 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” screen will not work in Python console.

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.

Clear Screen in Python

1. Using Print

>>> print(“\n” * 80)

2: 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.