取外网IP

取外网IP

def getWanip():
    try:
        data = urllib.urlopen("http://www.sogou.com/features/ip.jsp").read()
        m=re.search("([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)",data)
        return m.group()
    except:
        raise "getWanip failed"
socket.gethostbyname('...') 返回的不一样?
urllib.urlopen('http://www.whatismyip.org').read()


用我这个吧..呵呵
print socket.gethostbyname('www.whatismyip.org')
data=urllib.urlopen('http://www.whatismyip.org').read()
m=re.search("([0-9]*)\.([0-9]*)\.([0-9]*)\.([0-9]*)",data)
print m.group()

结果:
206.176.224.3
222.66.20.82

2个代表的是啥IP?