0

How do i clear my screen in Python Shell?

I want my code to run my code like from a clear screen in shell... clearing whatever was already there. Just like there if is clrscr() in c++ i think.

8th Jan 2018, 6:05 PM
Arjun Saini
Arjun Saini - avatar
10 Answers
+ 2
If there is, idk, I use Python Idle u.u Try writing some of these: clr cls clear
8th Jan 2018, 6:27 PM
SebastiĂĄn Zapata
SebastiĂĄn Zapata - avatar
+ 1
You can print "\n" * 30
8th Jan 2018, 6:14 PM
SebastiĂĄn Zapata
SebastiĂĄn Zapata - avatar
+ 1
i use idle as well. Actually i tried that before that u just said.. to print'\n' but it takes the cursor and the end of the page. What i wanted is to print at the top of clear screen.
8th Jan 2018, 6:30 PM
Arjun Saini
Arjun Saini - avatar
+ 1
os.system('cls') should do the trick on Windows
8th Jan 2018, 7:11 PM
Marcus SĂžndergaard
Marcus SĂžndergaard - avatar
+ 1
print('\33[2J\33[f',end='') print('Hello world!') # '\33[2J' could be enough, but depending of user console, not always put cursor at 0,0 (screen origin), what does '\33[f' # google search for 'ansi escape codes' for more information ;)
8th Jan 2018, 9:58 PM
visph
visph - avatar
0
ain't there any command?.. like there's in any other language
8th Jan 2018, 6:24 PM
Arjun Saini
Arjun Saini - avatar
0
How to Clear Screen in Python IDLE: Working Solution (https://b3steng.com/how-to-clear-screen-in-python-idle-working-solution/) An article has just been released to answer this question. Very simple and working solution. Follow the link above.
1st Sep 2018, 2:07 PM
Loic Dimitri Gouater
Loic Dimitri Gouater - avatar
0
How to Clear Screen in Python IDLE: Working Solution (https://b3steng.com/how-to-clear-screen-in-python-idle-working-solution/) An article has just been released to answer this question. Very simple and working solution. Follow the link above.
1st Sep 2018, 2:08 PM
Loic Dimitri Gouater
Loic Dimitri Gouater - avatar
0
How to Clear Screen in Python IDLE: Working Solution (https://b3steng.com/how-to-clear-screen-in-python-idle-working-solution/) An article has just been released to answer this question. Very simple and working solution. Follow the link above.
1st Sep 2018, 2:08 PM
Loic Dimitri Gouater
Loic Dimitri Gouater - avatar
0
Just close and start python idle again. It works fine for me
5th Sep 2019, 6:56 AM
Peter Kamara
Peter Kamara - avatar