Clear Screen in Python

0 votes
Can anyone tell me how do I clear the screen in Python. I use the commands to clear the screen in windows and linux but how to do it in Python?
Sep 27, 2018 in Python by ana1504.k
• 7,910 points
1,239 views

2 answers to this question.

0 votes

If you are using the interpreter prompt >>>, press ctrl + L to clear screen.

For Windows, use :

import os
os.system('cls')

or

For Linux :

os.system('clear') 

answered Sep 27, 2018 by SDeb
• 13,300 points
0 votes
pip3 install clear-screen

and then:

from clear_screen import clear

clear()
answered Jan 28, 2019 by Zong
Hello Zong. Thanks! This works! But do you have an easier way to do this?

Related Questions In Python

+3 votes
7 answers

How can I rename a file in Python?

yes, you can use "os.rename" for that. ...READ MORE

answered Mar 31, 2018 in Python by DareDev
• 6,890 points
20,082 views
+2 votes
2 answers

How can I create a new file in Python?

You can try the below code which ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
1,339 views
+2 votes
3 answers

what is the practical use of polymorphism in Python?

Polymorphism is the ability to present the ...READ MORE

answered Mar 31, 2018 in Python by anto.trigg4
• 3,440 points
4,940 views
+2 votes
2 answers

Error while printing hello world in python.

You must be trying this command in ...READ MORE

answered Mar 31, 2018 in Python by GandalfDwhite
• 1,320 points
6,494 views
0 votes
1 answer

how do i clear the screen in python?

import os os.system('cls') or os.system('clear') READ MORE

answered Mar 19, 2019 in Python by Mohammad
• 3,230 points
1,222 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,467 views
0 votes
1 answer

Indentation of Python in Notepad++

To indent the block, select the entire ...READ MORE

answered Sep 18, 2018 in Python by SDeb
• 13,300 points
2,366 views
0 votes
1 answer

Print C format in Python

For printf- style formatting and special case ...READ MORE

answered Sep 18, 2018 in Python by SDeb
• 13,300 points
1,028 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP