from
urllib
import
request
#直接打开http://ip.dnsexit.com/index.php进行IP查询
with request.urlopen(
"http://ip.dnsexit.com/index.php"
) as f:
data
=
f.read();
IP
data[
2
:
-
1
]
print
(IP);
[2016-01-17][python][查询外网IP]
原文:http://www.cnblogs.com/qhy285571052/p/5138052.html