Can I clear the screen of IDLE interactive mode in Windows? I tried with the following code which fails to work:
import os
os.system('cls')
The cls command works only in Windows terminal(command prompt) and it doesn't work in IDLE screen.
Is there any other way? Or first of all, is there any hope to clear that IDLE interactive mode???
cls
and clear
are commands which will clear a terminal (ie a DOS prompt, or terminal window). If you are using the shell within IDLE, which won't be affected by such things, a workaround might be to print a lot of empty lines with print("\n" * 100)
. See also this answer for more information.