»°ËµPython£¨Î壩¿ªÊ¼Æð·É°É
С°×¶ÔÉϽڿÎÀïµÄ“СÂéȸ”ÐËȤ°»È»£¬ÕûÌì¾ÍÔÚËÞÉáµ·¹Ä¡£Õâ²»£¬¼¸ÌìÏÂÀ´ËûÒѾ¹¥ÏÂÊ®¼¸¸öÍøÕ¾ÁË¡£
С²Ëȴϲ»¶Ò»¸öÈË×øÔÚµçÄÔÅԱߣ¬Öå×Åüͷ£¬ÐÀÉÍ×ÅÕâÒ»ÐÐÐÐ×Ô¼º¿´²»¶®µÄ´úÂë¡£“ÕâЩ×Ö·ûºÃ¹ÖÒìѽ£¡”С²ËÍá×ÅÍ·£¬“ËüΪɶ½ÐÕýÔò±í´ïʽÄØ£¿”
°Ù¶Èһϣ¬ÖÕÓÚÖªµÀ¡£Ð¡²ËÔÚ½ñÌìÉÏ¿ÎÇ°ËƺõÁìÎòµ½ÁËÕýÔò±í´ïʽµÄÕæÚУ¬ÐÄÖÐÇÔϲ£º“½ñÌìÎÒÒªºÃºÃÏÔ°Úһϣ¬¿´Ë»¹ËµÎҲˡ£”
ûÏëµ½£¬½ñÌì´óÅ£ÀÏʦȴ¶ÔÕýÔò±í´ïʽֻ×ÖδÌá¡£
“Ê×ÏÈ£¬ÎÒÃÇÓ¦¸ÃÖªµÀ×Ô¼ºÏëҪʲô£¡”´óÅ£ÀÏʦÏòͬѧÃǽ²µÀ£¬·Â·ðÊÇÔÚÉÏÕÜѧ¿Î£¬“ÎÒÃǵÄÅÀ³æCrawlerÏëÒªµÃµ½Ê²Ã´ÄØ£¿”
CrawlerÖ»ÓÐÒ»¸öÄ¿µÄ£¬ÄǾÍÊÇ»ñÈ¡Ö¸¶¨ÍøÒ³µÄÄÚÈÝ£¬ÌáÈ¡ÀïÃæµÄÁ´½Ó¡£Èç´Ëµ¥Ò»µÄÄ¿µÄÈçºÎʵÏÖÄØ£¿
ÏÖÔÚÎÒÃÇ¿ÉÒÔ²ÂÏëÒ»ÏÂCrawlerµÄ¹¹³É£º
1¡¢Crawler±ØÐëÓÐÒ»¸öÀàÊÇÓÃÀ´ÅÀÐеģ¬ÃûΪCrawl¡£Ê×ÏÈ£¬Ëü½ÓÊÕControl´«µÝµÄÁ½¸ö¶ÓÁУºÒ»¸öÊÇÌṩµØÖ·µÄ£¬Ò»¸öÊÇÓÃÀ´´¢´æCrawlÅÀÐеõ½µÄÐÅÏ¢¡£
2¡¢CrawlerÊÇ»ùÓÚ¶àÏ̵߳ģ¬¸ÃÀà½ÐWorker¡£CrawlÀàÔÚÅÀÐÐʱʹÓÃWorkerʵÏÖ¶àÏ̡߳£WorkerÀà»áÌṩһ¸öÏ̳߳أ¬Ê¹ÅÀÐÐÓÐÐò¡¢Îȶ¨ºÍ¿ìËÙ¡£
3¡¢Crawler±ØÐëÓÐÒ»¸öÀàÀ´¼Ç¼ÍøÒ³µÄÏà¹ØÐÅÏ¢£¬°üÀ¨Á´½Ó¹Øϵ¡¢×¥È¡Ê±¼ä¡¢ÓÅÏȼ¶µÈ£¬ËüÊÇÒ»¸öÊý¾Ý½á¹¹£¬ÊµÏÖËü²¢²»ÄÑ¡£
Ïȱ𼱣¬ÔÚ±àдSparrowµÄCrawler֮ǰ£¬ÓбØÒªÑо¿Ò»ÏÂËüÊÇÈçºÎ±»µ÷Óõġ£
CrawlerÓÐÒ»¸ö¿ØÖÆÆ÷½ÐControl£¬Ëü½«Ò»ÏµÁÐÍøַдµ½Ò»¸ö¶ÓÁÐÀ¹©CrawlerÅÀÐС£Control³õʼ»¯Ò»¸öCrawler£¬¶ÓÁÐÒÔ²ÎÊýµÄÐÎʽ´«µÝ¸øCrawler£¬Crawler¿ªÊ¼¹¤×÷ºó£¬Á¢¼´´Ó¸Ã¶ÓÁÐÀï¶ÁÈëÒ»¸öÍøÖ·£¬½øÐÐһϵÁвÙ×÷ºó·µ»Ø¸ÃÍøÒ³µÄÄÚÈݺÍÍøÒ³ÄÚµÄËùÓÐÁ´½Ó£¬²¢½«ËüÃǷŵ½ÁíÒ»¸ö¶ÓÁÐÀï¡£ÕâÁ½¸ö¶ÓÁж¼ÊÇÓÉControlÌṩµÄ£¬CrawlerÖ»¸ºÔðץȡÍøÒ³ºÍ·ÖÎöÁ´½Ó¡£
ÕâÑù£¬ÎÒÃǾÍÇå³þÁË£ºÈç¹û½«Crawler±È×÷ÊֵĻ°£¬Control¾ÍÊÇ´óÄÔ¡£ControlÓÖÊÇÔõÑùʵÏÖÄØ£¿
ControlÌṩ¸øCrawlerÁ½¸ö¶ÓÁУ¬²¢Æô¶¯Crawler¡£³õʼ»¯CrawlerµÄÓï¾äΪ
crawler=Crawler(request_queue,result_queue)
“Ϊʲô²»ÈÃCrawler×Ô¼ºÑ»·Ö´ÐÐÄØ£¿”С°×ÎʵÀ¡£
ÔÒòÓжþ£º
1¡¢ÎÒÃÇÐèÒª¶ÔÅÀÐкóµÃµ½µÄ½á¹û½øÐд¦Àí£¬Ö»ÄÜÈÃCrawlerÅÀÐÐÎÒÃÇÏëÒªµÄÍøÒ³£¬¶ø²»ÊÇÈÃÅÀ³æÂþÎÞÄ¿µÄµÄÂҹ䡣
2¡¢ÈÃCrawler×Ô¼ºÑ»·ÈÝÒ×Ôì³ÉËÀÑ»·£¬µ¼ÖÂÒç³öÉõÖÁ±ÀÀ£¡£
“ControlºÃ¼òµ
Ïà¹ØÎĵµ£º
±àÒëÁËÒ»¸öwindowsϵÄpython3Á¬½ÓMysqlµÄ¿â
mypysql
°æ±¾ÊÇ 0.5.1 £¬¸ù¾Ý¹Ù·½µÄÐÞ¸ÄÈÕÖ¾£¬Õâ¸ö°æ±¾ÐÞ¸ÄÁË0.5ÖÐÒ»¸öÄÚ´æй©ÎÊÌâ¡£
Ô´´úÂëºÍ±àÒëºóµÄÎļþΪ£º
http://211.147.215.55/down/mypysql-0.5.1-win.zip
mypysqlµÄ¹Ù·½µØÖ· https://sourceforge.net/projects/mypysql/
......
#from pp3e Chapter 9.3
#############################################################################
# popup three new window, with style
# destroy() kills one window, quit() kills all windows and app; top-level
# windows have title, icon, iconify/deiconify and protocol for wm events;
# there ......
ÕÛÌÚ¼ÆËã»ú£¬±»¼ÆËã»úÕÛÌÚ£¬Ç°Ç°ºóºóÒ²ÓÐÊ®¼¸Äê¡£
×î¿É±¯µÄÊǾÓȻһÎÞËù³É£¬ËäÈ»½ö½ö³öÓÚÐËȤ£¬²¢ÎÞ¹¤×÷֮ѹÁ¦£¬µ«ÊÇÕâÖÖ´ìÕÛ¸ÐȷʵÊÇʵ´òʵµÄ¡£
ÒѾ¼Ç²»ÆðÊÇÄÄÒ»ÌìÁË£¬ºÃÏñͻȻ¾ÍÖªµÀÁËpythonµÄ´æÔÚ£¬´Ó×î³õµÄ²»¾Ò⣬µ½Ô½À´Ô½Ï²°®£¬ÎÒÒ»²½²½µÄÏòpython¿¿½ü¡£
ÎÒϲ»¶Python£¬ÕâÊÇÒ»¸öÊÂʵ£¬ÎÒ׫´ ......
ÒëÕßÑÔ£º
ÔçÔÚ 2008 Äê 8 Ô£¬ÎÒ¾ÍÔøÔÚ×Ô¼ºµÄ²©¿Í·¢±íÁËһƪ¡¶ÎªÊ²Ã´<Dive into Python>²»ÖµµÃÍƼö¡·£¨http://blog.csdn.net/lanphaday/archive/2008/08/28/2845258.aspx
£©£¬µ±Ê±ÒýÆðµÄÌÖÂ۾Ͳ»¶à˵ÁË£¬²»¹ýÊÂʵÉϵ½½ñÌìÈÔÈ»ÓÐÐí¶àÅóÓÑÁôÑÔÓëÎÒÌÖÂÛ£¬ÈÃÎÒ¼¸´ÎÔôÐIJ»ËÀ£¬ÏëдÔÙÉîÈëÅúÅС£ºÃÔ˵ÄʱºòÔÚÎÒÕæÕýÔÜ×㶯Á ......