pangxia75 发表于 2017-5-7 12:32:25

python subprocess.Popen 监控控制台输出

file_out = subprocess.Popen('ping www.baidu.com', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while True:
line = file_out.stdout.readline()
print(line)
if subprocess.Popen.poll(file_out)==0: #判断子进程是否结束
break
页: [1]
查看完整版本: python subprocess.Popen 监控控制台输出