Like most Python developers, I typically keep a console window open with the Python interpreter running to test commands, dir()
stuff, help() stuff
Quickest and easiest way without a doubt is Ctrl+L.
This is the same for OS X on the terminal.
I am using Spyder (Python 2.7) and to clean the interpreter console I use either
%clear
that forces the command line to go to the top and I will not see the previous old commands.
or I click "option" on the Console environment and select "Restart kernel" that removes everything.
OK, so this is a much less technical answer, but I'm using the Python plugin for Notepad++ and it turns out you can just clear the console manually by right-clicking on it and clicking "clear". Hope this helps someone out there!
If you don't need to do it through code, just press CTRL+L
Wiper is cool, good thing about it is I don't have to type '()' around it. Here is slight variation to it
# wiper.py
import os
class Cls(object):
def __repr__(self):
os.system('cls')
return ''
The usage is quite simple:
>>> cls = Cls()
>>> cls # this will clear console.
Arch Linux (tested in xfce4-terminal
with Python 3):
# Clear or wipe console (terminal):
# Use: clear() or wipe()
import os
def clear():
os.system('clear')
def wipe():
os.system("clear && printf '\e[3J'")
... added to ~/.pythonrc
clear()
clears screenwipe()
wipes entire terminal buffer