Answers for "python ip address increment"

0

python ip address increment

# Import module
import ipaddress
 
# Arithmetic Operation on IPv4 address
print(ipaddress.IPv4Address(u'129.117.0.0')-6)
print (ipaddress.IPv4Address(u'175.199.42.211')+55)
print (ipaddress.IPv4Address(u'0.0.0.0')-1)
print (ipaddress.IPv4Address(u'255.255.255.255')+1)
 
# Arithmetic Operation on IPv6 address
print (ipaddress.IPv6Address(u'2001:0db8:85a3:2bfe:070d:8a2e:0370:7334')-330)
print (ipaddress.IPv6Address(u'2001:0db8:85a3:2bfe:070d:8a2e:0370:7334')+1000)
print (ipaddress.IPv6Address(u'0000::0000')-1)
print (ipaddress.IPv6Address(u'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff')+1)
Posted by: Guest on October-17-2021

Python Answers by Framework

Browse Popular Code Answers by Language