Clear screen in shell

Just a quick question:
How do you clear the screen in shell? I've seen ways like:

    import os
    os.system('cls')

This just opens the windows cmd, clears the screen and closes but I want the shell window to be cleared
(PS: I don't know this helps, but I'm using version 3.3.2 of Python)
Thank you :)

For OS X, you can use subprocess module and call 'cls' from shell:

    import subprocess as sp
    sp.call('cls',shell=True)

To prevent '0' from showing on top of the window, replace the 2nd line with:

    tmp = sp.call('cls',shell=True)

For linux, you must replace cls command with clear

    tmp = sp.call('clear',shell=True)

From: stackoverflow.com/q/18937058

Back to homepage or read more recommendations: