2024-06-30 16:38:22 发布
网友
完全限定的域名由^{}返回。在
但是:它的作用与“hostname--fqdn”不同。在
以下问题的评论中有一些暗示,但我想知道标准答案。How do I get my computer's fully qualified domain name in Python?
如何像hostname --fqdn那样获取FQDN。在
hostname --fqdn
综合起来:
Python3:
import socket socket.getaddrinfo(socket.gethostname(), 0, flags=socket.AI_CANONNAME)[0][3]
Python2:
学分: How do I get my computer's fully qualified domain name in Python?
综合起来:
Python3:
Python2:
^{pr2}$学分: How do I get my computer's fully qualified domain name in Python?
相关问题 更多 >
编程相关推荐