Python 官方文档:入门教程 => 点击学习
python中实现单线程绑定域名解析,具体方法如下:import timeimport Socketdef ReadHost(file): hosts=[] ... return hostsdef SynResolve(fr): h
import time
import Socket
def ReadHost(file):
hosts=[]
...
return hosts
def SynResolve(fr):
hosts=ReadHost(fr)
IPs={}
for host in hosts:
try:
results=socket.getaddrinfo(host,None)
for result in results:
print host, result[4][0]
IPs[result[4][0]]=host
except Exception,e:
print e
file.close()
if __name__=='__main__':
start=time.time()
print 'starting at: ',start
SynResolve('host')
print 'ending at: ',time.time()-start
--结束END--
本文标题: python如何绑定域名解析
本文链接: https://lsjlt.com/news/114573.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
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