Skip to content Skip to main navigation Skip to footer

python中getaddrinfo()函数用法实例分析

python中getaddrinfo()函数是如何来使用的呢?下面的内容将会通过具体的实例来演示python中getaddrinfo()函数的使用方法及相关技巧:

本文实例讲述了python中getaddrinfo()基本用法。分享给大家供大家参考。具体如下:

import sys, socket
result = socket.getaddrinfo("192.1.1.100", None)
print result[0][4]
print result
 

输出结果:

('172.20.53.102', 0)
[(2, 0, 0, '', ('172.20.53.102', 0))]
 


python中getaddrinfo()函数就是这样,欢迎大家参考。。。。

0 Comments

There are no comments yet

Leave a comment

Your email address will not be published.