Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

"clear" command in Python

View clear.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
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.