import dns.resolver
result = dns.resolver.query('baidu.com', 'A')
for ipval in result:
print('IP', ipval.to_text())
IP 123.125.115.110
IP 220.181.57.216
import dns.resolver
result = dns.resolver.query('news.baidu.com', 'CNAME')
for cnameval in result:
print(' cname target address:', cnameval.target)
cname target address: news.n.shifen.com.