#!/usr/bin/python# -*- coding: utf-8 -*-'''Created on Dec 6, 2013@author: Jay <smile665@gmail.com>@description: use PhantomJS to parse a web page to get the geo info of an IP'''from selenium import webdriverimport sysreload(sys)sys.setdefaultencoding('utf-8')driver = webdriver.PhantomJS(executable_path='./phantomjs') #这要可能需要制定phatomjs可执行文件的位置driver.get("https://www.ip.cn/125.95.26.81")#print driver.current_url#print driver.page_sourceprint driver.find_element_by_id('result').text.split('\n')[0].split('来自:')[1]driver.quit#!/usr/bin/python# -*- coding: utf-8 -*-'''Created 你的当前访问异常,请进行认证后继续阅读剩余内容。 提交