python subprocess.Popen 控制台输出 实时监控百度网ping值
import subprocess 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