`
mldxs
  • 浏览: 25066 次
  • 性别: Icon_minigender_1
  • 来自: 吉林
文章分类
社区版块
存档分类
最新评论

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
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics