#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)
#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)
转载于:https://www.cnblogs.com/monsteryang/p/6562052.html