`
yuhai.china
  • 浏览: 154369 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论
文章列表
<%@ page contentType="text/xml;charset=gbk"%><%@ page import="org.apache.commons.dbcp.*" %><%@ page import="java.io.*" %><%@ page import="java.util.*" %><%@ page import="java.util.regex.*" %><%@ page import="jav ...
package org.apache.nutch.fetcher; import java.io.IOException; import java.util.HashSet; import java.util.Iterator; import org.apache.commons.httpclient.DefaultHttpMethodRetryHandler; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpClient; import org. ...
StringIO就是把内存里的数据封装成文件句柄 import os, sys import Image import StringIO size = 128, 128 outfile = 'D:/wallcoo-3.jpg' try: #im = Image.open('D:/wallcoo.jpg') fp=open("D:/wallcoo.jpg", "rb") buffer=fp.read() im = Image.open(StringIO.StringIO(buffer)) ...
f=open('wuqu.html','r') content=f.read() m=re.findall('<tr>[\w|\W]*?</tr>', content) print len(m) if m is None:return for i in range(1,len(m)): c=m[i] d=re.findall('<a[\w|\W]*?</a>', c) if d is None:continue if not len(d) = ...
#coding=gbk from Tkinter import * import pycurl import sys, re, md5, os, time, commands import pycurl import cStringIO as _StringIO import sys import shutil, urllib, urllib2 import socket,sqlite3 as sqlite import datetime, time from time import sleep site='12530' # MIME type accept_t ...
urllib2.quote(u'北京'.encode('utf-8'))
问题描述: 在用nutch1.0做generate 包括5亿url的crawldb时,它默认按照64M分块,分成777个map task,在运行的后期出现 Could not find taskTracker/jobcache/job_200903231519_0017/attempt_200903231519_0017_r_000051_0/output/file.out in any of the configured local directories 异常。 解决办法: 减小task数目,改成按照crawldb里面文件个数划分的策略: public static class In ...
准备工作 安装Python2.5 安装easy_install,pycurl,lxml;建议使用firefox浏览器,可以方便的使用各 种调试插件。 基本知识 需要了解python中unicode的原理,以便掌握GBK和UTF-8的转换方法. 假设content是GBK编码,在python中,转换成UTF-8的方法如下: Content=Content.decode(‘gbk’).encode(‘utf-8’) 3  专业技能 需要熟练掌握xpath,强烈推荐在信息抽取时使用xpath,这是一种基于文档结构 的方法。优于使用正则表达式。正则表达式是一种字符串匹配的方法,难于维 ...
http://www.eclipse.org/tptp/home/downloads/4.5.0/documents/quicktour/quick_tour.html Eclipse Test and Performance Tools Platform
准备工作 可以使用Python2.5,推荐使用2.4,因为需要兼顾wkfs的接口。 安装easy_install,pycurl,lxml;建议使用firefox浏览器,可以方便的使用各种调试插件。 基本知识 需要了解python中unicode的原理,以便掌握GBK和UTF-8的转换方法. 假设content是GBK编码,在python中,转换成UTF-8的方法如下: Content=Content.decode(‘gbk’).encode(‘utf-8’) Python中的常用集合类包括链表list=[]和字典dict={}。 3  专业技能 熟练掌握xpath,强烈推荐在信 ...
   通常来说nutch应该部署在多台机器上,做并行抓取,那么配置nutch在单机windows下有什么意义呢?就是方便debug。 下面分步骤详述。 1.安装JDK 6,eclipse3.2以上版本 2.为eclise安装IBM mapreduce tools插件 http://www.alphaworks.ibm.com/tech/mapreducetools 3.安装cygwin,并设置环境变量 4.下载nutch源代码,我使用的是最新的1.0版本 5.在eclipse中创建MapReduce Project工程。将nutch下的src/java下的所有代码复制到工程的src目录下,a并 ...
f5 shenru f6 over f7 return
#coding=gbk import lxml.etree import lxml.html as x f=open('f:/test.html','r') c=f.read() doc=x.document_fromstring(c) alist=doc.xpath("//a") for a in alist: tree=lxml.etree.ElementTree(a) print tree.getpath(a)
In mod_python it's: req.headers_out["Content-type"] = "application/force-download" req.headers_out["Content-Disposition"] = "attachment; filename=%s" % filename #/usr/local/apache/htdocs/segmentMusic req.headers_out['Content-Disposition'] = 'handler; filena ...
from mod_python import apache def handler(req):    req.content_type = "text/plain"    req.write("Hello World!")    return apache.OK
Global site tag (gtag.js) - Google Analytics