There are multiple ways to convert an IPv4 address to an IPv6 address. In Python 3, we have the inbuilt ipaddress module:
import ipaddressdef convertusingipaddress(ipv4address): print(ipaddress.IPv6Address('2002::' + ipv4address).compressed)convertusingipaddress("10.10.10.10")convertusingipaddress("192.168.100.1")
The output for the preceding code is as follows:
![](/api/v2/epubs/9781788299466/files/assets/c282518a-6ed2-428c-873a-8fba881c3855.jpg)