How to avoid os.system() printing out return value in python

前端 未结 4 905
一整个雨季
一整个雨季 2021-01-20 18:29

I\'m using Python to call bash to execute another bash script:

begin = int(sys.argv[1])
result = os.system(\"/tesladata/isetools/cdISE.bash %s\" %begin)
         


        
4条回答
  •  遥遥无期
    2021-01-20 19:12

    Your python script does not have the output of the bash script at all, but only the "0" returned by it. The output of the bash script went to the same output stream as the python script, and printed before you printed the value of result. If you don't want to see the 0, do not print result.

提交回复
热议问题