python commands模块

来源:互联网 发布:mac 查看 arp 缓存 编辑:程序博客网 时间:2024/05/15 15:58
#!/usr/bin/python#-*- coding:UTF-8 -*-'''Created on 2015年6月10日@author: huangpeng03'''import commandsif __name__ == '__main__':   status, output =  commands.getstatusoutput('ls')   print status   print output   print type(status)   print type(output)

注意 output类型是str而不是list,昨天搞了半天这个以为是个list


console:

0beanstalk_tst.pybeanstalk_tst.pycdemo1.pydemo2.py<type 'int'><type 'str'>


0 0