#!/usr/bin/python
#coding=utf-8
import socket
import re
def getip():
import re,urllib2
print re.search('\d+\.\d+\.\d+\.\d+',urllib2.urlopen("http://www.whereismyip.com").read()).group(0)
#中间的那个http地址因不同的IP查询网站而group内容不一样,如果是http://whois.ipcn.org/的话,可能就group(1)了
if __name__ == '__main__':
getip()