def getip():
def visit(url):
opener = urllib2.urlopen(url)
if url == opener.geturl():
str = opener.read()
return re.search('\d+\.\d+\.\d+\.\d+', str).group(0)
try:
myip = visit("http://pv.sohu.com/cityjson?ie=utf-8")
except:
try:
myip = visit("http://w.1616.net/chaxun/iptolocal.php")
except:
try:
myip = visit("http://www.ip138.com/ip2city.asp")
except:
myip = "218.107.55.252"
return myip获取访问网址出去ip
最新推荐文章于 2025-09-22 17:28:27 发布
2万+

被折叠的 条评论
为什么被折叠?



