Reply content:
Is it necessary to be so complicated?
Give it a try
Import OS
Os.system (' CLS ')
It's only one more 0.
---------------------------
Forgot to say, this only a cmd to work, IDLE seems to not work.
Why use your own idle? Integration to VS and command-line convenience. The original link: Python Idle clear screen problem resolution
In the process of learning and using Python, there is no need to deal with Python idle. But using Python IDLE will encounter a common and annoying question-how do I clear the screen?
The answer is to add a clear screen extension ClearWindow for IDLE (in issue 6143:idle
Can see the description of this extension).
Let me tell you how to use the installation.
1. Download clearwindow.py
(Right-click-the target is saved as, the format is the end of the PY, direct click will open the script content).
2, copy the clearwindow.py file, put in Python installation directory Python xxx\lib\idlelib (XXX for your Python version).
3, Notepad open the Python xxx\lib\idlelib directory under the config-extensions.def (Idle extension configuration file), in order to prevent errors, you can open it before you copy a backup.
4, modify the Config-extensions.def, add the following at the end, and then save the exit:
[ClearWindow]
Enable=1
Enable_editor=0
Enable_shell=1
[Clearwindow_cfgbindings]
clear-window=
5, open the python idle,options option to see the addition of the Clear Shell window Ctrl +;.
6, enter the code in the idle, then press CTRL +; (the ctrl and;), and find that the code you just entered can be cleared.
Description:
Shortcut key CTRL +;, can be modified to other keys, "clear-window= " control and change to other keys.
After the experiment, control change to alter, will not start idle, change to shift, shortcut keys do not work, because shift+l, directly into the input L. You can refer to the solution of the Python idle screen problem
turn off the re-open I also very hate idle this point, if can be like Matlab CLEAR,CLC a sentence to take care of, unfortunately we have to install plug-in br>
If I don't install the plugin, I think I'll have to do it.
The first few said unsuccessful, the file name, ClearWindow initials, so you can It worked. Good trouble, or shut the re-open it. If there's a clear command, 2016 years of new approach, Python 3.5.1 + Windows
Pip install Idlex
Then create a shortcut
C:\Python3\pythonw.ex E "c:\Python3\scripts\idlex.pyw"
Path is replaced by its own actual situation, it is OK
Disadvantage: Use the arrow keys up and down the input command to traverse, if there are multiple lines of input history, will be stuck there why my What do you do with the steps? Under Options There is only one Python Configure option Thanks, the installation is complete!