06 2013 档案

摘要:在上一节我们回顾了python 多线程的知识。queue这个线程安全的序列正是python用来实现线程池的关键。我们可以把爬虫需要解析的URL放入这个序列中,供其它空闲的线程获取并使用。线程池的实现:import ThreadPool.dlthreadclass threadpool: def... 阅读全文
posted @ 2013-06-29 22:07 爱知菜 阅读(201) 评论(0) 推荐(0) 编辑
摘要:在将程序移植到python之前,先来复习一下python的多线程编程的相关知识。请看下面的一段代码:import timeimport threadingimport urllib.requestimport queueclass ThreadUrl(threading.Thread): de... 阅读全文
posted @ 2013-06-27 17:29 爱知菜 阅读(183) 评论(0) 推荐(0) 编辑
摘要:在上一篇中,我们提到了管道这个概念(pipeline),其实所有的管道都实现了同一接口叫 public interface IPipelineStep { void Process(Crawler crawler, PropertyBag propertyBag); }所有爬到的网址都将被构造Cr... 阅读全文
posted @ 2013-06-27 10:16 爱知菜 阅读(171) 评论(0) 推荐(0) 编辑
摘要:NCrawler 是一款 .net 上的开源爬虫,虽然它没有arachnode.net那么成熟完善,但是代码量小,设计结构好,很适合大家研读。在NCrawler.Demo项目下的Program.cs文件中,找到Main函数函数开头的一段代码,是打开HTTP协议的限制(对同一个WEB最多同时发起两个连... 阅读全文
posted @ 2013-06-26 22:15 爱知菜 阅读(319) 评论(0) 推荐(0) 编辑
摘要:__author__ = 'wei'# -*- coding: utf-8 -*-__author__ = 'wei'import getoptimport sysimport osimport py_compiledef setparams(): global srcpath,pycpath... 阅读全文
posted @ 2013-06-25 15:02 爱知菜 阅读(298) 评论(0) 推荐(0) 编辑
摘要:public static byte[] Stream2Bytes(ref Stream s) { if (s == null) { return null; } s.... 阅读全文
posted @ 2013-06-21 16:21 爱知菜 阅读(356) 评论(0) 推荐(0) 编辑
摘要:ROC曲线标识了为了达到某个TPR(识别率),伴随而来的该分类器的FPR(误判率)是多少,体现了这两者的关系。与ROC曲线类似的还有一个上升图,表示为了达到相应的识别率,需要投入的成本是多少(这个成本可以是样本数量)。ROC 曲线的横坐标表示 一个负的实例被当作正实例的概率(FPR),纵坐标表示一个... 阅读全文
posted @ 2013-06-14 17:48 爱知菜 阅读(888) 评论(0) 推荐(0) 编辑
摘要:logging.basicConfig(level=logging.INFO,filename=c.config_dict['logfile'],filemode='a',format='%(levelname)s[%(asctime)s]:%(message)s',datefmt='%Y-%m-%... 阅读全文
posted @ 2013-06-06 15:48 爱知菜 阅读(222) 评论(0) 推荐(0) 编辑
摘要:装adodbapi前一定要装 pywin32 这个库(http://www.lfd.uci.edu/~gohlke/pythonlibs)下载adodbapi(http://pan.baidu.com/s/1bnd5j5d),解压,运行命令行python setup.py install连接字符串 ... 阅读全文
posted @ 2013-06-06 15:27 爱知菜 阅读(228) 评论(0) 推荐(0) 编辑
摘要:转自:http://blog.163.com/y845766643@126/blog/static/17104630220101123113029840/r+: Open for reading and writing. The stream is positioned at the beginni... 阅读全文
posted @ 2013-06-06 14:42 爱知菜 阅读(273) 评论(0) 推荐(0) 编辑
摘要:推荐大家看看这篇文章:http://qinxuye.me/article/details-about-time-module-in-python/从时间戳到时间结构体:time.localtime([secs])从时间结构体转换到时间戳:time.mktime(t)从时间结构体打印出某个指定格式的字... 阅读全文
posted @ 2013-06-03 09:55 爱知菜 阅读(1209) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示