subprocess
subprocess模块是python从2.4版本开始引入的模块。主要用来取代 一些旧的模块方法,如os.system、os.spawn、os.popen、commands....subprocess
try:
subprocess.check_call("sdf",shell=True)
except subprocess.CalledProcessError as...try:
output = subprocess.check_output("lT -l",shell=True,stderr=subprocess.STDOUT)
except subprocess.CalledProcessError...(['python3'],stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=subprocess.PIPE,)
proc.stdin.write(...捕获错误输出
proc = subprocess.Popen(['python3'],stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=subprocess.PIPE