python调用程序控制输出
import subprocess
// 注意要使用shell=True控制前面是命令,stdout指出采用管道方式转移stdout
pipe = subprocess.Popen("ls -l | grep ^d", shell=True, stdout=subprocess.PIPE)
// 此处即原本输出到stdout的内容
pipe.stdout.readlines()
|
||||||
python调用程序控制输出
import subprocess
// 注意要使用shell=True控制前面是命令,stdout指出采用管道方式转移stdout
pipe = subprocess.Popen("ls -l | grep ^d", shell=True, stdout=subprocess.PIPE)
// 此处即原本输出到stdout的内容
pipe.stdout.readlines()
Leave a Reply |
||||||
|
Copyright © 2010 鱼常游而忘飞 - All Rights Reserved.
>>>辽ICP备05003652号<<<
|
||||||