`
文章列表
# coding=utf-8 ''' Created on 2017年3月2日 @author: chenkai ''' import xlrd #读取excel data =xlrd.open_workbook("F:\\test.xlsx") table=data.sheets()[0] nrows=table.nrows#行数 ncols=table.ncols#列数 print "行数: ",nrows,"列数: " ,ncols for i in range(0,nrows):     print "---- ...
ppython标准异常分类 BaseException           所有异常的基类 SystemExit              解释器请求退出 KeyboardInterrupt 用户中断执行(通常是输入^C) Exception         常规错误的基类 StopIteration         迭代器没有更多的值 GeneratorExit         生成器(generator)发生异常来通知退出 StandardError        所有的内建标准异常的基类 ArithmeticError         所有数值计算错误的基类 FloatingPoint ...
windows下: import os cmdres= os.popen("ping baidu.com").read() print cmdres.decode("gbk") linux下: import os os.system("ls /").read()
方法一)使用js脚本直接操作,方法如下: js="var q=document.getElementById('id').scrollTop=10000" driver.execute_script(js) 或: js="var q=document.documentElement.scrollTop=10000" driver.execute_script(js) 这里的id为滚动条的id,但js中没有xpath的方法,所以滚动条没有id的网页此方法不适用 方法二)使用js脚本拖动到提定地方 target = driver.find_el ...
# coding=utf-8 ''' Created on 2017年2月20日 @author: chenkai ''' import MySQLdb import sys from selenium import webdriver from bs4 import BeautifulSoup from selenium.webdriver.common.by import By import time from selenium.webdriver.remote import webelement from selenium.webdriver.remote.webelement ...
#coding=utf-8 from selenium import webdriver #driver=webdriver.Ie()   #调用ie浏览器 #driver=webdriver.Firefox()  #调用firefox浏览器 driver=webdriver.Chrome()  #调用chrome浏览器 driver.get('https://www.baidu.com') print driver.title#输出title driver.quit()#关闭驱动 1 在chrome 下运行脚本,需要将chromedriver.exe 放在chrome浏览器安装目 ...
# coding=utf-8 ''' Created on 2017年2月16日 @author: chenkai ''' from sys import argv script, first, second, third = argv print 'The script is called:',  script print 'Your first variable is:',  first print 'Your second variable is:',  second print 'Your third variable is:',  third eclipse中写python代码, ...
1.下载chardet后把chardet解压 2.然后把chardet 复制到D:\anzhuang\Python27下 3.进入cmd命令提示符 4.输入 cd:D:\anzhuang\Python27\chardet-2.3.0 5.输入 d: 6.显示为D:\anzhuang\Python27\chardet-2.3.0> python setup.py install 7.进入python import chardet 不报错 则安装成功 注:如果有朋友是用eclipse写python代码,可能会出现导入chardet库失败 需要重新配置一次python, 点击windows ...
elasticsear 环境变量配置 新建: ES_HOME D:\elasticsearch-2.3.5\bin 验证是否安装成功:cmd   ----> 进入d:/elasticsearch/bin  命令运行: elasticsearch.bat 网页输入:localhost:9200 页面显示内容如下:安装成功 {   "name" : "Hippolyta",   "cluster_name" : "elasticsearch",   "version" : {     ...
package databaseDB_connection; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; /* * 创建连接数据库(需要数据库服务保持运行状态,需要ojdbc6.jar包) * */ public class util { public static Connection getConnection() { Connection ...
1.去beautiful soup官网上去下载最新版本是4.3.0。 2.下载完成之后需要解压缩,假设放到python安装目录下。 3.运行cmd,切换到D:/python/beautifulsoup4-4.1.3/目录下(根据自己解压缩后的目录和下载的版本号修改), cd C:\Python27\beautifulsoup4-4.3.0> 运行setup.py build命令(或python setup.py build), 再运行setup.py install命令(或python setup.py install)。 然后输入python,进入python模块 然后输入 ...
下载casperjs,解压后命名为casperjs 添加环境变量: path:D:\anzhuang\casperjs\bin cmd中输入:casperjs -version 输出 版本信息表示安装成功
下载phantomjs后解压,重命名为phantomjs 添加环境变量 path:D:\anzhuang\phantomjs\bin; cmd提示符窗口下 cd到D:\anzhuang\phantomjs\examples 目录 运行命令:phantomjs hello.js 打印结果为:Hello, world! 表示安装以及配置成功
1.去beautiful soup官网上去下载最新版本是4.3.0。 2.下载完成之后需要解压缩,假设放到python安装目录下。 3.运行cmd,切换到D:/python/beautifulsoup4-4.1.3/目录下(根据自己解压缩后的目录和下载的版本号修改), cd C:\Python27\beautifulsoup4-4.3.0> 运行setup.py build命令, 再运行setup.py install命令。 然后输入python,进入python模块 然后输入from bs4 import BeautifulSoup检测是否成功。 没有报错,则安装成功 安装包 我已经 ...
# coding=utf-8 ''' Created on 2017年2月5日 @author: chenkai 就把正则表达式的相关内容到这里填充一下。 今天说说元字符是什么东西。  \     ^    $   *    +     .    |    ?    {}    []    ()         这就是元字符了,学会这些应该就够你用的了。 python中的正则表达式通过import re 来使用。 www.iplaypython.com python教程 ''' #正则表达式是引入re包 import re s = r"abc" # 定义一个字符串规 ...
Global site tag (gtag.js) - Google Analytics