Python 官方文档:入门教程 => 点击学习
本文实例讲述了python实现的简单dns查询功能。分享给大家供大家参考,具体如下: #!/usr/bin/Python import sys,Socket def print_array(*arr):
本文实例讲述了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)
更多关于Python相关内容感兴趣的读者可查看本站专题:《Python Socket编程技巧总结》、《Python函数使用技巧总结》、《Python字符串操作技巧汇总》、《Python入门与进阶经典教程》及《Python文件与目录操作技巧汇总》
希望本文所述对大家Python程序设计有所帮助。
--结束END--
本文标题: Python实现的简单dns查询功能示例
本文链接: https://www.lsjlt.com/news/13202.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0