标签:add nbsp ip地址 taobao style 地址 code cat div
#!/usr/bin/env python # -*- coding: utf-8 -*- import signal import urllib import json import sys,os,re import socket url = "http://ip.taobao.com/service/getIpInfo.php?ip=" def ip_location(ip): data = urllib.urlopen(url + ip).read() datadict=json.loads(data) for oneinfo in datadict: if "code" == oneinfo: if datadict[oneinfo] == 0: return datadict["data"]["city"] ip_address = ‘114.114.114.114‘ city_address = ip_location(ip_address) print ip_address + ":" + city_address
标签:add nbsp ip地址 taobao style 地址 code cat div
原文地址:http://www.cnblogs.com/vincent-liang/p/7060157.html