最简单取得外网IP
#coding=utf-8
import urllib2
import re
print re.search('\d+\.\d+\.\d+\.\d+',urllib2.urlopen("http://www.ip138.com/ip2city.asp").read()).group(0)
re.search('\d+\.\d+\.\d+\.\d+',urllib2.urlopen("http://1212.ip138.com/ic.asp").read()).group(0)