- 博客(6)
- 资源 (6)
- 收藏
- 关注
原创 第一个PyQuery完整抓取网页例子
#-*-coding:utf-8-*-from pyquery import PyQuery as pqimport CommonUtils'''搞趣网抓取'''def parseGao7(url='http://www.gao7.com/free/1-0-0-3-0-0-1') : result=[] data=pq(url) if data :
2013-04-27 18:41:28 2622
转载 python抓取时gzip解压
'''根据URL返回内容,有些页面可能需要gzip解压缩'''def getUrlContent(url): #返回页面内容 doc = urllib.request.urlopen(url).read() #解码 try: html=gzip.decompress(doc).decode("utf-8") except:
2013-04-27 17:28:51 3957
原创 python抓取网页
#-*- coding:utf8 -*-import urllib.parseimport urllib.request'''根据返回数据获取网页编码格式'''def getCharSet(response) : contype = response.headers['Content-Type'] pos = contype.find('=') if -1
2013-04-26 20:01:38 796
转载 java 四舍五入
/** * 提供精确的小数位四舍五入处理。 * @param v 需要四舍五入的数字 * @param scale 小数点后保留几位 * @return 四舍五入后的结果 */ public static double round(double v,int scale){ if(scale<0){ r
2013-04-18 14:59:50 627
原创 junit 单元测试
import org.junit.After;import org.junit.Before;import org.junit.runner.RunWith;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.http.HttpEntity;import org.
2013-04-16 10:18:26 1167
原创 java 读取网络图片的大小(宽+高)
InputStream is = new URL("http://ruanliecache.rydigital.com/rt0/rs640x538/fy/uploads/2013/04/1146.jpg").openStream(); BufferedImage sourceImg =ImageIO.read(is); // //
2013-04-02 19:45:25 4068 3
Core Python Programming----Source Code
2013-05-15
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人