Skip to content

Instantly share code, notes, and snippets.

@dusansimic
Created August 1, 2016 11:09
Show Gist options
  • Save dusansimic/e3b8603111b2781461822cfc4a907a68 to your computer and use it in GitHub Desktop.
Save dusansimic/e3b8603111b2781461822cfc4a907a68 to your computer and use it in GitHub Desktop.
Small python script for clearing console window.
import os
import sys
if sys.platform() == "win32":
def clear(): os.system("cls")
elif sys.platform() == "linux2":
def clear(): os.system("clear")
elif sys.platform() == "cygwin":
def clear(): os.system("clear")
elif sys.platform() == "darwin":
def clear(): os.system("clear")
elif sys.platform() == "freebsd7":
def clear(): os.system("clear")
elif sys.platform() == "freebsd8":
def clear(): os.system("clear")
else:
print("Unknown platform : could not define clear() function!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment