import os
import string
interfacename = "eth0"
str1 = "ifconfig | cut -d' ' -f1 | sed '/^$/d'"
str2 = "ifconfig " +interfacename+" | grep \"inet addr:\" | awk '{print $2}' | cut -c 6-"
str3 = "ifconfig eth0 | grep \"inet addr:\" | awk '{print $2}' | cut -c 6- "
output = os.popen(str2)
strs = output.read()
print type(strs)
l = strs.split()
print l
print "1"
多网卡下获取网卡名称
最新推荐文章于 2024-03-11 11:33:34 发布