import os
os.system("ls -l")
import subprocess
test = subprocess.Popen(["ping","-W","2","-c", "1", "192.168.1.70"], stdout=subprocess.PIPE)
I prefer usage of subprocess module:from subprocess import call call(["ls", "-l"])
Reason is that if you want to pass some variable in the script this gives very easy way for example take the following part of the codeabc = a.c call(["vim", abc])
No comments:
Post a Comment