Constantly print Subprocess output while process is running

后端 未结 13 809
庸人自扰
庸人自扰 2020-11-22 06:51

To launch programs from my Python-scripts, I\'m using the following method:

def execute(command):
    process = subprocess.Popen(command, shell=True, stdout=s         


        
13条回答
  •  粉色の甜心
    2020-11-22 07:40

    In Python 3.6 I used this:

    import subprocess
    
    cmd = "command"
    output = subprocess.call(cmd, shell=True)
    print(process)
    

提交回复
热议问题