ipaddress
Work with IPv4/IPv6 addresses and networks.
Easy
import ipaddress
net = ipaddress.ip_network("192.168.1.0/24")
ipaddress.ip_address("192.168.1.42") in net # True
net.num_addresses # 256
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.