In [
1
]: from netaddr
import
*
In [
2
]: ip = IPAddress(
'172.16.100.39'
)
ip.format()ip地址的格式化
'172.16.100.39'
repr(ip)
"IPAddress('172.16.100.39')"
ip = IPNetwork(
'172.16.100.39/24'
)
ip.network
IPAddress(
'172.16.100.0'
)
ip.broadcast
IPAddress(
'172.16.100.255'
)
ip.ip
IPAddress(
'172.16.100.39'
)
ip.size
256
ip.netmask
IPAddress(
'255.255.255.0'
)
ip.hostmask
IPAddress(
'0.0.0.255'
)