"whether two hosts belong to the same subnet" library ipaddress in python

  python

it is necessary to develop a program that determines whether two hosts belong to the same subnet (given the IP addresses of two computers and the subnet mask)
using the ipaddress library in python
so far, it has only been possible to implement getting all kinds of addresses

https://docs.python.org/3/library/ipaddress.html

net = ipaddress.IPv4Network(ip, False)
net.network_address
net.num_addresses
net.broadcast_address
list(net.hosts())

Source: Python Questions

LEAVE A COMMENT