python module for nslookup
Question: Is there a python-module that's doing the same stuff as nslookup does? I am
planning to use nslookup on digging some information regarding the domain of a
URL to be scrapped. I know I can use os.sys to call nslookup but I am just
wondering if there is a python-module for this already. Thanks in advance!


Answer: You need to use [DNSPython](http://www.dnspython.org/)

    
    
    import dns.resolver
    
    answers = dns.resolver.query('dnspython.org', 'MX')
    for rdata in answers:
        print 'Host', rdata.exchange, 'has preference', rdata.preference
    

