Skip to content

@jmendeth /clear.py
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
"clear" command in Python
class clear:
def __call__(self):
import os
if os.name==('ce','nt','dos'): os.system('cls')
elif os.name=='posix': os.system('clear')
else: print('\n'*120)
def __neg__(self): self()
def __repr__(self):
self();return ''
clear=clear()
'''
Import this file (from clear import clear)
or paste the above lines of code into
your shell or in your script.
Then, use "-clear" to clear the screen, i.e:
>>> -clear
Or call it as a function:
>>> clear()
Or if you're on a shell, you can also type:
>>> clear
This file can be called as a regular program, also.
'''
if __name__=='__main__': clear()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.