利用Python指定DNS解析域名 - 走看看 (zoukankan利用Python指定DNS解析域名 - 走看看 (zoukankan.com)利用Python指定DNS解析域名 - 走看看 (zoukankan
看了几个都不行!!!
Server= ( '223.5.5.5', '114.114.114.114', '119.29.29.29' ) Port=53 dns_query = dns.message.make_query('baidu.com', 'A') for s in Server: a = dns.query.udp(dns_query, s, Port) print(s,':') for i in a.answer: for j in i.items: if j.rdtype == 1: # 加判断,不然会出现AttributeError: 'CNAME' object has no attribute 'address' print(j.address)