Is there a quiet version of subprocess.call?

后端 未结 4 1649
渐次进展
渐次进展 2020-12-10 10:27

Is there a variant of subprocess.call that can run the command without printing to standard out, or a way to block out it\'s standard out messages?

4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-10 10:36

    Yes. Redirect its stdout to /dev/null.

    process = subprocess.call(["my", "command"], stdout=open(os.devnull, 'wb'))
    

提交回复
热议问题