How to clear the screen in Python

python, screen

Solution

If you mean the screen where you have that interpreter prompt, `>>>`, you can do CTRL+L in the Bash shell. Windows does not have equivalent. You can do

import os
os.system('cls')  # On Windows (<https://ss64.com/nt/cls.html>)

or

os.system('clear')  # On Linux / OS X

Problem

Possible Duplicates: Clear the terminal in Python How can I clear the interpreter console? I'm trying to write a program in Python, but I don't know how to clear the screen. I use both Windows and Linux, and I use commands to clear the screen in those, but I don't know how to do it in Python. How do I use Python to clear the screen?

Original source

Related problems