时间:2021-07-01 10:21:17 帮助过:8人阅读
本文实例讲述了Python实现的简单dns查询功能。分享给大家供大家参考,具体如下:
#!/usr/bin/python import sys,socket def print_array(*arr): array = arr for item in array: print item[4][0] print '''this script is for host resolve print "now this begin... if you want to leave,please input "break"''' while 1: try: 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)
【相关推荐】
1. 分享Python实现SMTP发送邮件图文实例
2. 利用Python实现Youku视频批量下载功能实例
3. 分享python中and / or 的运算逻辑实例教程
4. Python:逻辑判断与运算符实例
以上就是分享Python实现dns查询功能实例的详细内容,更多请关注Gxl网其它相关文章!