import ipaddress
def convertusingipaddress(ipv4address):
print(ipaddress.IPv6Address('2002::'
+ ipv4address).compressed)
ipaddr=input("Enter
your ip here: ")
convertusingipaddress(ipaddr)
OUTPUT
=======================================================================================================================================================
Note: In the above-given Python program there is one inbuild library imported
to convert the Ipv4 into Ipv6 i.e.; “ipaddress” After that in
the second line one function has been defined named “convertusingipaddress” inside that function. I
have printed using the module define at the top with the help of “.” Basically,
it means the object of that inbuild module i.e.; “IPv6Address('2002::' +
ipv4address)” will be converted in IPv6, and with “.compressed” I have
compressed the original Ipv6 onto the compressed form of the IP address.
Comments
Post a Comment