码迷,mamicode.com
首页 > 编程语言 > 详细

python 获取subprocess进程执行后返回值

时间:2019-04-20 09:18:23      阅读:590      评论:0      收藏:0      [点我收藏+]

标签:pytho   csdn   style   targe   port   pop   gcc   wait   执行   

 

test.py

#coding=utf-8
import subprocess
compilePopen = subprocess.Popen(gcc haha,shell=True,stderr=subprocess.PIPE)
compilePopen.wait()
print(the status code is:,compilePopen.returncode)
with open(log,w) as object:
    object.write(compilePopen.stderr.read())

输出:

(the status code is:, 1)

 

参考:

https://blog.csdn.net/qq_31331027/article/details/80518348

python 获取subprocess进程执行后返回值

标签:pytho   csdn   style   targe   port   pop   gcc   wait   执行   

原文地址:https://www.cnblogs.com/sea-stream/p/10739724.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!