使用subprocess.Popen
,用于communicate
读取和写入数据:
out, err = subprocess.Popen(['ls','-l'], stdout=subprocess.PIPE).communicate()
那么你可以随时从拆分的过程串stdout
用splitlines()
。
out = out.splitlines()
Python子进程readlines()?
使用subprocess.Popen
,用于communicate
读取和写入数据:
out, err = subprocess.Popen(['ls','-l'], stdout=subprocess.PIPE).communicate()
那么你可以随时从拆分的过程串stdout
用splitlines()
。
out = out.splitlines()