2 ответов
+ 2
You can use os module to use CLS in system shell.
if you are windows, this should work for you:
>>>import os
>>>os.system("cls")
If you don't want to use os module, you can make a function that prints a lot of new lines every time you call it(not really recommended) :
>>>def clear():
print('\n'*100)
+ 1
ΛM!N Thanks, but that does not help.
os.system("cls") works only on the intepreter launched from the command prompth.
With IDLE intepreter it only prints 0, but doesn't clear anything.
print("\n"*100)
Does something, but it is not comfortable, as I don't want the intepreter to display everything in bottom of the window. I just thought there could have been a shortcut to reopen the intepreter.