Share Python to implement DNS query function instances

Source: Internet
Author: User
This article mainly introduces the simple DNS query function implemented by Python, and analyzes the implementation technique of the DNS information query based on the socket module in the form of instance, and the friend can refer to the following

The examples in this article describe the simple DNS query functionality that Python implements. Share to everyone for your reference, as follows:

#!/usr/bin/pythonimport sys,socketdef Print_array (*arr):    array = arr for    item in array:        print item[4][0] print ' This script was for the host Resolveprint ' now this begin...if you want to leave,please input ' break ' and ' while 1:    t RY:        host = raw_input ("Please input the host:")    except Keyboardinterrupt:        print "\ n",        continue    Except:        print "\ n",        continue    if host = = "Break" or host = = "": Break    result = Socket.getaddrinfo (Host,none,0,socket. SOCK_STREAM)    Print_array (*result)

"Recommended"

1. Share Python to implement SMTP send message graphics instances

2. Use Python to implement Youku video batch download function instance

3. Sharing the example of and/or in Python tutorial

4. Python: logical judgment and Operator instance

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.