How to clear python shell

There is no single built-in command to clear python shell. But we can achieve this through other ways. Shown below is a method that you can follow to clear your shell.
import os os.system('cls') # For Windows os.system('clear') # For Linux/OS X
When this command is executed your shell will be cleared and you can see a ‘0’ on top of the screen. To prevent ‘0’ from showing on top of the window, replace the 2nd line with:
temp=os.system('cls')
Or you can just simply quit the python shell using quit() and then clear the screen using cls and again start the python shell
Subscribe
Login
Please login to comment
0 Discussion