python subprocess
来源:互联网 发布:阿里指数能看淘宝吗 编辑:程序博客网 时间:2024/05/22 08:09
import os
os.system('etc/program') #full path of the program
os.system('gedit')
#os.system('notpad.exe') #for windows
or:
os.popen()
os.popen() behaves similar to a file open(), the default is "r" for read, so for write to have to addd a "w". You can specify the buffer size in bytes or use the default of zero.
os.popen('program').write('whatever')
a = os.popen("cmd","w")
a.write("bla")
some discussion here: http://www.daniweb.com/forums/thread40790.html
see more here: http://docs.python.org/library/os.html
also: http://effbot.org/librarybook/os.htm
*******************
Use another method, subprocess, which is recommended. http://docs.python.org/library/subprocess.html
also http://www.oreillynet.com/onlamp/blog/2007/08/pymotw_subprocess_1.html
import subprocess# Command with shell expansion
subprocess.call('ls -l $HOME', shell=True)
subprocess.Popen('echo "Hello world!"', shell=True) #command through the shell.
This blog is also very great: http://jimmyg.org/blog/2009/working-with-python-subprocess.html
###################################################
- python subprocess
- python subprocess
- PYTHON SUBPROCESS
- Python --- subprocess
- python subprocess
- python subprocess
- python -- subprocess
- python subprocess
- Python-subprocess
- python----subprocess
- Python 中的 Subprocess
- Python中的subprocess
- Python模块subprocess小记
- Python模块subprocess小记
- python subprocess Popen
- python得subprocess模块
- Python中subprocess学习
- Python模块subprocess小记
- 给WRTP54G的语音部分设置正确的时间
- datagridview 整行上移下移
- 动态规划 :POJ 1014 Dividing
- SCA概念与应用实践(7.SCA装配模型--7.8连线 wire)
- Error establishing socket的解决方法
- python subprocess
- ipv6 socket 编程中遇到的问题
- ibus and fcitx
- 基于ipv6的socket通信(TCP)
- 【实例】结构体转换为类
- 我怎么和别人不一样
- 【图论】【RQNOJ】拜年
- 大家好
- 今天总算可以开通博客了