How to clear python shell ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to clear python shell ?

When after lots of commands have executed is there any option to clear all the commands and outputs on the shell window?

17th Jul 2020, 12:01 PM
Abijith . U
Abijith . U - avatar
11 Answers
+ 3
exit()
17th Jul 2020, 12:03 PM
Bharat
Bharat - avatar
+ 1
quite()
18th Jul 2020, 8:34 AM
Ashwini Adsule
Ashwini Adsule - avatar
0
Mansi 👑 No I meant in Python shell exit() command will completely terminate the window and lead to reopen the window . I just only need to get rid of the previous commands. Like clrscr() in C, C++ kind of...
17th Jul 2020, 12:06 PM
Abijith . U
Abijith . U - avatar
0
For windows, >>> import os >>>os.system('cls') Or else >>> import os >>>os.system('clear')
17th Jul 2020, 12:11 PM
Arnesh
Arnesh - avatar
0
Arnesh bro thanks for the reply but By applying these commands I got only extra 0 and 1 that's all
17th Jul 2020, 12:15 PM
Abijith . U
Abijith . U - avatar
0
🇮🇳Vivek🇮🇳 bro that doesn't make any changes
17th Jul 2020, 12:15 PM
Abijith . U
Abijith . U - avatar
0
Arnesh >>>import os >>>os.system('cls') 0 >>>import os >>>os.system('clear') 1 >>> This is what I got ..😓
17th Jul 2020, 12:18 PM
Abijith . U
Abijith . U - avatar
0
🇮🇳Vivek🇮🇳 No bro I'm coding in Python shell window Ctrl+L doesn't change anything at all....
17th Jul 2020, 12:20 PM
Abijith . U
Abijith . U - avatar
0
Abijith . U which Python shell window you are using based on CLI or that comes with python IDE
17th Jul 2020, 3:06 PM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar
0
AKSHAY yes the python shell comes with python IDE
18th Jul 2020, 1:20 AM
Abijith . U
Abijith . U - avatar
- 1
Abijith . U check this code https://code.sololearn.com/cq4r7Ylt0wPG/?ref=app Remember one thing it will clear all variable including built-in variables
18th Jul 2020, 8:27 AM
AKSHAY🇮🇳
AKSHAY🇮🇳 - avatar