sta*_*tti 4 python visualization data-visualization geolocation
我有一个约300个IP地址的列表,我想在世界地图上绘制.你能粗略解释一下如何用Python做到这一点吗?
编辑:我也对问题的可视化部分感兴趣
您可以使用hostip.info API.例如:
http://api.hostip.info/get_html.php?ip=64.233.160.0
Run Code Online (Sandbox Code Playgroud)
所以你使用的Python代码urllib2是:
import urllib2
f = urllib2.urlopen("http://api.hostip.info/get_html.php?ip=64.233.160.0")
data = f.read()
f.close()
Run Code Online (Sandbox Code Playgroud)
然后从返回的结果中检索数据.
如果您需要经度和纬度,请使用position=true标志:
http://api.hostip.info/get_html.php?ip=64.233.160.0&position=true
Run Code Online (Sandbox Code Playgroud)