Python获取外网IP代码

jopen 5年前

#!/usr/bin/env python  # -*- coding: utf-8 -*-  import urllib2,re  url = 'http://iframe.ip138.com/ic.asp'  x = urllib2.urlopen(url).read()  print re.search('\d+\.\d+\.\d+\.\d+',x).group(0)