請通過Python代碼片段下面去的Python subprocess.Popen()
import subprocess
child = subprocess.Popen("python ./myprog.py ", shell=True)
print "Hello"
哪裏myprog.py很簡單:print "Hello,myprog"
我得到的輸出是:
Hello
Hello,myprog
我問題是子進程是否開始平行於父進程運行,或者子進程是否等待父進程完成,如上面的輸出所示?
我碰巧爲類似的帖子做了一個答案:http://stackoverflow.com/questions/89228/how-to-call-external-command-in-python/2251026#2251026 – newtover