import os, platform
def c():
p = platform.system()
if p == "Windows":
os.system("cls")
else:
os.system("clear")
Not really needed use in Linux:
cmd/ctr + l
in MacOS:cmd + K
import commands
status, output = commands.getstatusoutput("cat /etc/services")
import subprocess
output = subprocess.check_output("cat /etc/services", shell=True)
import subprocess
proc = subprocess.Popen(["cat", "/etc/services"], stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
print "program output:", out
import subprocess
def exc(*cmd):
if len(cmd) > 1:
li = list(cmd)
else:
li = cmd
proc = subprocess.Popen(li, stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
print "program output:", out
def exc(*cmd):
li = list(cmd)
proc = subprocess.Popen(li, stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
print "program output:", out