获取本地IP信息,用纯Python
2016-08-23
0 0 0
暂无评分
其他
如何获取积分?
class MyIpInfo--Get local ip information
class IpAddress--ip address
class IpNetwork--ip network
example:
m = MyIpInfo( )
print "hostname", m.hostname
print "my ip list", m.iplist
print "local ip", m.localip
print "has inet", m.has_inet
print "inet ip", m.inetip
print "---------------"
ipstr = '192.168.0.3'
ip = IpAddress(ipstr)
print ip
print "is_lan_ip=", ip.is_lan_ip()
print "within network", ipstr+'/255', ip.within(ipstr+'/255')
n = IpNetwork('192.168.0.1', '255.255.255.0')
n = IpNetwork('192.168.0.1/255')
print "IpNetwork", n
print "has",ipstr,"=",n.has(ipstr)
python
IP
信息
获取
本地
相关源码推荐
背单词软件
0
0
暂无评分
python-ela
0
0
暂无评分
用python实现ntrip功能
0
0
暂无评分
有一辆最大货运量为10t的卡车,用以装载4种货物,每种货物的单位重量及相应单位价值如下表所示。每种货
0
0
暂无评分
Python实现五子棋
0
0
暂无评分
暂无评论