I use os.system('cls')
in Pycharm to clear the screen from what has been printed before. However, when running the code, it does not clear the formerly printed stuff, and instead prints an upward arrow at the end. What can the problem be?
Asked
Active
Viewed 9,142 times
4

Markus Meskanen
- 19,939
- 18
- 80
- 119

Alex L
- 147
- 1
- 4
-
3could you try os.system("clear") – Jamal Alkelani May 25 '19 at 16:05
-
Does typing `cls` to the terminal (outside of the Python interactive interpreter) clear the formerly printed stuff? `cls` only works on Windows, use `clear` for Unix – Markus Meskanen May 25 '19 at 16:10
2 Answers
7
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.

BoarGules
- 16,440
- 2
- 27
- 44