I have a command line interface in python as a project and would like to be able to get my terminal to wipe clean after it has completed delivering a set of instructions. Is there a command for this?
Asked
Active
Viewed 40 times
-1

martineau
- 119,623
- 25
- 170
- 301

lisa-underwater
- 1
- 1
-
You mean clear the terminal window? – Barmar Jun 08 '22 at 15:45
-
In iPython, typing `cls` will clear the terminal. – S3DEV Jun 08 '22 at 15:48
3 Answers
0
if you want to clear the terminal from your python code, you can use os.system("clear")
on linux or os.system("cls")
on windows.

DavinderJolly
- 106
- 6
0
I'm not sure I understand your wish properly, but with the intention of helping, if your command line interface is running in a REPL ( Read, Evaluate, Print and Loop) interface - a python shell to execute a single python command and display the result - then the commands used to clear the terminal or Python shell are cls
and clear
.
Depending on your OS, you can run the following:
Windows
import os
os.system(‘CLS’)
Linux
import os
os.system(‘clear’)
For more details you can check this link
I hope it was of some help!

Ruben Esteche
- 26
- 6
-1
What IDE are you using? With the Spyder IPython console, you can use CTRL + L.

FreyGeospatial
- 325
- 4
- 17