摘要: 如下是一个获取机器eth0 网卡ip的使用示例。cmd='''ifconfig eth0|grep "inet "|awk '{print $2}'|awk -F":" '{print $2}' '''ret,ip = commands.getstatusoutput(cmd)#print ip, retif ret != 0 : print "get ip failed"; sys.exit(2) 阅读全文
posted @ 2012-12-10 16:57 @且听风吟@ 阅读(605) 评论(0) 推荐(0)