0
我正在使用ip2location Python庫來找出相應的ip地址的位置。我試圖打開一個包含ip地址列表的文件,並通過它找出相應的位置。ip2location python庫中的錯誤
import IP2Location;
IP2LocObj = IP2Location.IP2Location();
IP2LocObj.open("data/IP-COUNTRY-REGION-CITY-. LATITUDE-LONGITUDE-ZIPCODE-TIMEZONE-ISP-DOMAIN-NETSPEED-AREACODE-WEATHER-MOBILE-ELEVATION-USAGETYPE-SAMPLE.BIN");//This is sample database
File1=open('test_ip.txt','r');//This is file containing ipaddress
Line=File1.readline();
While line:
rec = IP2LocObj.get_all(Line);
Line=File1.readline();
print rec.country_short
這段代碼是給error.You可以檢查出樣品代碼在這裏http://www.ip2location.com/developers/python
你能提供完整的錯誤信息嗎? – elena