[2016-01-17][python][查询外网IP]

[2016-01-17][python][查询外网IP]

1
2
3
4
5
6
7
8
9
10
from urllib import request
 
def GetIP():
#直接打开http://ip.dnsexit.com/index.php进行IP查询
    with request.urlopen("http://ip.dnsexit.com/index.php") as f:
        data = f.read();
    return data[2:-1]
 
IP = GetIP();
print(IP);


来自为知笔记(Wiz)


posted on 2016-01-17 23:15  红洋  阅读(211)  评论(0)    收藏  举报

导航