How to clear screen in python?
As we all know that there is no in-built function to clear the screen in python. But sometimes it becomes very necessary to clear the screen.
In the interactive python shell we can clear screen it by pressing “control + l”. But this will not work in python console.
So what will we do to clear screen in python console?
There is one method. In this method we have to import a module. Module name is os.
syntax:-
import os os.system('cls')
e.g.,
import os print("hello, world") print("Python is an object-oriented programming language") os.system('cls')
Subscribe
Login
Please login to comment
0 Discussion