代码改变世界

随笔档案-2016年05月

Python 爬虫的工具列表

2016-05-10 10:11 by LI桥IL, 4775 阅读, 收藏,
摘要: 0x00 网络 1)通用 urllib -网络库(stdlib)。 requests -网络库。 grab – 网络库(基于pycurl)。 pycurl – 网络库(绑定libcurl)。 urllib3 – Python HTTP库,安全连接池、支持文件post、可用性高。 httplib2 – 阅读全文

glob访问过多的路径缓存太慢

2016-05-05 16:38 by LI桥IL, 444 阅读, 收藏,
摘要: 不知道有没有一边读 一边运行的 方法 阅读全文

pandas/excel 获得sheet名 修改数据多个sheet 行该列 列排序 归一输出,创建excel 添加sheet 写入excel

2016-05-05 16:29 by LI桥IL, 8791 阅读, 收藏,
摘要: 1 # -*- coding: utf-8 -*- 2 3 import sys 4 import glob 5 import os 6 from xlrd import open_workbook 7 import xlwt 8 import pandas as pd 9 from xlutils.copy import copy 10 import numpy as np... 阅读全文

filexpath统计文件或文件夹数量/大小

2016-05-05 16:24 by LI桥IL, 369 阅读, 收藏,
摘要: @1.获取文件大小 使用os.path.getsize函数,参数是文件的路径。 @2.获取文件夹大小,即遍历文件夹,将所有文件大小加和。遍历文件夹使用os.walk函数 阅读全文

Developer进阶书单

2016-05-04 17:03 by LI桥IL, 178 阅读, 收藏,
摘要: https://github.com/phodal/booktree http://www.51testing.com/?uid-437299-action-spacelist-type-blog-itemtypeid-25164 阅读全文

selenium加载本地配置文件 ; 获取页面动态html ; 静态html

2016-05-03 11:49 by LI桥IL, 1581 阅读, 收藏,
摘要: 1 # -*- coding: utf-8 -*- 2 from selenium import webdriver 3 import sys 4 import urllib2 5 import time 6 import codecs 7 reload(sys) 8 sys.setdefaultencoding('utf-8') 9 10 def gethtml(url):... 阅读全文

excel在不改变格式的情况下,对两个名字的某几个日期下的内容进行替换

2016-05-03 11:37 by LI桥IL, 1083 阅读, 收藏,
摘要: 1 #-*- coding: UTF-8 -*- 2 import xlrd 3 import sys 4 import locale 5 import os 6 import xlwt 7 from xlutils.copy import copy 8 9 reload(sys) 10 sys.setdefaultencoding( "utf-8" ) 11 homedir... 阅读全文

txt文件分解为固定条数的文件

2016-05-03 11:18 by LI桥IL, 234 阅读, 收藏,
摘要: #-*- coding: UTF-8 -*- # import linecache # count = linecache.getline(filename,linenum) # 读取文件某一行的内容 # str = linecache.getlines(filename) # str为列表形式,每一行为列表中的一个元素 import sys import linecache reload(s... 阅读全文

txt1-txt2去重输出到txt3

2016-05-03 10:55 by LI桥IL, 263 阅读, 收藏,
摘要: 1 # -*- coding: utf-8 -*- 2 # python 2.7 3 import sys 4 reload(sys) 5 sys.setdefaultencoding( "utf-8" ) 6 # 本方法用于对txt1中含有的txt2内容进行去重,并输出到txt3 7 # 由于文件输出,写入过程中有不可见编码,所以用strip()进行扫尾 8 def txt_q... 阅读全文

xml元素定位

2016-05-03 10:48 by LI桥IL, 690 阅读, 收藏,
摘要: 1 #-*- coding: UTF-8 -*- 2 import sys 3 import lxml 4 import lxml.etree,StringIO 5 6 reload(sys) 7 sys.setdefaultencoding('utf-8') 8 9 10 def getxml_xpth_content(xpath,filepath,index=0): ... 阅读全文

redis安装;配置;启动;测试

2016-05-03 09:46 by LI桥IL, 670 阅读, 收藏,
摘要: Redis官方是不支持windows的,只是 Microsoft Open Tech group 在 GitHub上开发了一个Win64的版本,项目地址是:https://github.com/MSOpenTech/redis/releases 下载后直接解压,然后用redis-server red 阅读全文