原帖由 MingStar@CU 于 2006-7-21 16:56 发表
用commands模块吧
import commands
status, output = commands.getstatusoutput('ls -l')
原帖由 unixer2i 于 2006-7-21 21:46 发表
用用commands模块试了下,我的例子如下:
[code]
#!d:/apptools/Python/python
# filename useCMD.py
# just list the system command for use in python mode
impo ...
原帖由 guotie 于 2006-7-18 16:05 发表
6.8 subprocess -- Subprocess management
http://www.python.org/doc/2.4/lib/module-subprocess.html
原帖由 MingStar@CU 于 2006-7-21 23:29 发表
原因是commands模块只能在Unix(或Linux)里用~
详见:http://docs.python.org/lib/module-commands.html
欢迎光临 Chinaunix (http://bbs.chinaunix.net/) | Powered by Discuz! X3.2 |