于是,继续上面的代码:
>>> addrs = socket.getaddrinfo(hostname,None)
>>> for item in addrs:
print(item)
(, 0, 0, '', ('fe80::b976:b065:27d:3747%10', 0, 0, 10))
(, 0, 0, '',...('fe80::1456:951:2418:27cf%7', 0, 0, 7))
(, 0, 0, '', ('192.168.0.103', 0))...(, 0, 0, '', ('2001:0:9d38:6ab8:1456:951:2418:27cf', 0, 0, 0))
如此便可以获取本机所有