how to clear the screen in python

PythonScreen

Python Problem Overview


> Possible Duplicates:
> clear terminal in python
> How to clear python 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?

Python Solutions


Solution 1 - Python

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

import os
os.system('cls')  # on windows

or

os.system('clear')  # on linux / os x

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionshiesterView Question on Stackoverflow
Solution 1 - PythonSenthil KumaranView Answer on Stackoverflow