Python 2.7 执行某一程序并获取PID

来源:互联网 发布:捷克 语言 知乎 编辑:程序博客网 时间:2024/05/19 18:42

转自 :http://blog.csdn.net/arrsin/article/details/52791859

import subprocess 
import shlex 
args = shlex.split(command) 
p = subprocess.Popen(args) 
print p.pid 
我也很纳闷为什么一定要分割成数组才可以执行 如果不分割成数组 就提示 
OSError: [Errno 2] No such file or directory


阅读全文
0 0
原创粉丝点击