Validate IP Address
Last updated
Last updated
In order to validate an IP Address in Python, we can use ipaddress
module. Examples below -
ip_address
function throws an exception if the address is not a valid IPv4/IPv6 address.
We can also check the IP address version, by using version
attribute on ip_address
function.
Source: