资 源 简 介
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)