python----subprocess
2016-10-31 16:11
148 查看
交互运行子进程command.
subprocess.Popen(command.split(),stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
注意: command命令中如果含有空格,必须要用split()函数,否则会报错。
举例:运行“ls -l”
>>> subprocess.Popen("ls -l")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/subprocess.py", line 639, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1228, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
subprocess.Popen(command.split(),stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
注意: command命令中如果含有空格,必须要用split()函数,否则会报错。
举例:运行“ls -l”
>>> subprocess.Popen("ls -l")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/subprocess.py", line 639, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1228, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
相关文章推荐
- Python 中的 Subprocess
- python中使用subprocess调用外部程序
- python中使用subprocess调用外部程序
- python 启动进程,杀死 subprocess
- Python中subprocess学习
- [python]subprocess调用外部命令屏蔽输出
- python中的subprocess.Popen()使用
- Python模块学习 ---- subprocess 创建子进程
- python类库31[进程subprocess]
- Python模块学习 ---- subprocess 创建子进程
- Python 中的 Subprocess 多进程
- python安全管理子进程-subprocess - Python - language - ITeye论坛
- [转载]Python 中的 Subprocess
- (转)Python模块学习 ---- subprocess 创建子进程
- Python--- subprocess 创建子进程
- Python模块学习——subprocess
- Python中的subprocess
- Python:模块subprocess
- Python模块学习 ---- subprocess 创建子进程
- python安全管理子进程-subprocess