os.system('cls') doesn't clear the screen in Pycharm?
Solution 1:
PyCharm's emulation of the Windows system console isn't 100%. Neither is any IDE's. Try that in IDLE or PythonWin, and you will see that it also does something other than you might expect from the Windows console.
This behaviour is by design. Bear in mind that most real-world Python interactive applications do not interact with their users via input()
and print()
calls.
If you want your output to behave exactly like the Windows console then send your output to the Windows console.
Solution 2:
If you want the terminal to emulate your OSs terminal, you have to edit the 'Run/Debug Configuration' and tick the box 'Emulate terminal in output console'.
Then os.system("cls")
will clear the screen on Windows and os.system("clear")
on unix