python使用管道获取其它进程的输出内容

def GetLineListFromFile(sFileName):
	sCmd = "grep -i 'iphone os' " + sFileName;
	output = subprocess.Popen([sCmd],stdout=subprocess.PIPE,shell=True).communicate()
	lines = output[0].split('\n');
	return lines;
	#print (res)
	
def GetLineListFromArch(sFileName):
	sCmd = "zgrep -i 'iphone os' " + sFileName;
	output = subprocess.Popen([sCmd],stdout=subprocess.PIPE,shell=True).communicate()
	lines = output[0].split('\n');
	return lines;


你可能感兴趣的:(python,shell,OS,iPhone,output)