Home python How do I clear the Run Window with Python code?

How do I clear the Run Window with Python code?

Author

Date

Category

How can Python code clear the Run Window? I am writing in PyCharm.

I tried different options from the internet, but nothing works.

from os import system
print ("The console is still full of text.")
system ('cls') # leaves trash


Answer 1

If you notice that some symbol is still displayed in the paycharm console – this is the symbol for cleaning the console. Because Paycharm is designed to debug programs, and not to run them, it displays this symbol, and does not clear the console, this can help detect bugs in complex applications. If you save your program and run it with python, the console will really clean up. If you create an .exe file and put it on display for the community, it will also be cleaned for everyone.

So if you need (for specific reasons) to clear the paycharm console, do as advised SKIP – via pyautogui.
Or more simply print ("\ n" * 99999)

But then be prepared for the fact that many problems will become more difficult to detect.

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions