Does IP belong to the network

Run Settings
LanguagePython
Language Version
Run Command
from ipaddress import ip_network, ip_address # Define the CIDR block cidr = ip_network('188.88.0.0/19') # List of IP addresses to check ips = [ '188.88.2.98', '188.81.255.254', '188.88.12.171', '188.88.191.2' ] # Check which IP does not belong to the CIDR not_in_cidr = [ip for ip in ips if ip_address(ip) not in cidr] print(not_in_cidr)
Editor Settings
Theme
Key bindings
Full width
Lines