Skip to content

Instantly share code, notes, and snippets.

@jamesnotjim
Created May 2, 2019 20:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesnotjim/0be35dfaac2b55dec976a70ae06cd1df to your computer and use it in GitHub Desktop.
Save jamesnotjim/0be35dfaac2b55dec976a70ae06cd1df to your computer and use it in GitHub Desktop.
Clear the Terminal in Python
import os
if(os.name == "posix"):
os.system('clear')
else:
os.system('cls')
@jamesnotjim
Copy link
Author

What's this, then?

This is a handy snippet for clearing the Terminal before you send output to it. I've only tested it on OS X, but it is designed to work on other Posix systems and Windows as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment