Share your repls and programming experiences

← Back to all posts
Need to clear the terminal?
h
JordanDixon1 (324)

Hello! Have you ever needed to clear the python terminal? Well now you can!

Clearing Module for Python

This module is designed specifically to be cross-platform for python. All you do is import the module and use the clear() command to clear the terminal. That's it! This module automatically detects the os and switches the clearing command automatically for example:
On Windows you would have to do this:

import os
os.system("cls")

On Linux and other os you would have to do this:

import os
os.system("clear")

With my module you have two options the first is this:

import clearing
clearing.clear()

or you can do this to make the command even shorter!

from clearing import clear
clear()

If you would like to star the project and show your appreciation then go to the github for the project (here)[https://github.com/c00lhawk607/Clearing]

If you would like to install the module all you have to do is open a new cmd or bash or whatever shell you're using, and type this in:

pip3 install clearing

On repl.it you have to press ctrl + shift + S to open the shell. This module comes dependency-free using the built-in module: os. If you have any questions or comments go ahead and comment below or make a commit on github!

Commentshotnewtop
CodingCactus (3061)

just print '\033[2J\033[H'

JordanDixon1 (324)

@CodingCactus Does that really clear the terminal though? I you can scroll up and see the "cleared" area.