Return IPv6 address Python from domain name

半城伤御伤魂 提交于 2019-12-13 09:50:04

问题


So I searched a little on the Internet and I found that the socket class can return the IPv4 address from the domain name in python. IP address of domain on shared host says how to do it.

Can I do exactly the same thing but return IPv6 address? It looks like support for IPv6 in Python is a bit limited and I found no resources searching on the Internet.


回答1:


Take a look here, I think this is what you are looking for.

socket.getaddrinfo("example.com", None, socket.AF_INET6)



回答2:


You can use this convert. Ipv4 to ipv6. IPv4 to IPv6



来源:https://stackoverflow.com/questions/17775365/return-ipv6-address-python-from-domain-name

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!