>  Q&A  >  본문

Python OS模块 用Python调用cmd命令是如何让他在后台静默执行(不会突然跳出cmd弹窗)

麻烦问下各位大神

如何让Python在执行os.system(cmd)是不弹窗执行,让他在后台静默执行,有没有这样的方法。谢谢

示例代码:

#!/usr/bin/env python
# -*- coding:utf-8 -*-

import os

cmd = 'ping 127.0.0.1'

os.system(cmd)
黄舟黄舟2741일 전902

모든 응답(1)나는 대답할 것이다

  • ringa_lee

    ringa_lee2017-04-18 09:47:33

    하위 프로세스 실행 기능 사용

    으아아아

    회신하다
    0
  • 취소회신하다