从Python运行Shell脚本,如子进程

python
阅读 44 收藏 0 点赞 0 评论 0

pyshell.py
import subprocess

def runCommand(comm):
	'''
	Using the subprocess library this runs the command passed 
	'''
	proc = subprocess.Popen(comm.split(), stdout=subprocess.PIPE)
	outputstr = ''
	for line in proc.stdout.readlines():
		    outputstr+=line.rstrip()+"\n"
			
	return outputstr[:-1]
评论列表


问题


面经


文章

微信
公众号

扫码关注公众号