Èà easy_install ʹÓôúÀí·Ç½°²×° Python Ä£¿é
ÀµÓºƣ¨http://laiyonghao.com£©
¹Ø¼ü×Ö£ºpython, easy_install, setuptools, myentunnel, polipo, windows, linux, socks5, http, proxy
ÒòΪһЩÖÚËùÖÜÖªµÄÔÒò£¬ÎÒÃÇÓÐЩÍøÕ¾ÎÞ·¨·ÃÎÊ£¬Ôì³ÉÉú»îºÍÉú²úµÄ¾Þ´ó²»±ã¡£ÆäÖжÔÎÒÓ°Ïì±È½Ï´óµÄÒ»¸ö¾ÍÊÇ°²×°Ä³Ð© Python Ä£¿éµÄʱºò£¬easy_install ÎÞ·¨·ÃÎʵ½ÍøÕ¾¡£ÔÚÕâÀï·ÖÏíÈà easy_install ʹÓôúÀíµÄ·½·¨£¬Èç¹ûÄãÓµÓÐ socks5 »ò http ´úÀí·þÎñÆ÷¿ÉÓã¬Õâ¸ö·½·¨Äܹ»Èà easy_install ÍêÃÀµØ¿çÔ½³¤³Ç¡£
http
Ê×ÏȽéÉÜÈÝÒ×ʵÏÖµÄ http ·½Ê½¡£µÃÒæÓÚ python Ä£¿é urllib Äܹ»Í¸Ã÷ʹÓôúÀíµÄÄܹ»£¬easy_install ʹÓà http ´úÀíÊǷdz£·½Ê½µÄ¡£ÎÞÂÛÔÚ windows »¹ linux Ï£¬Ö»ÒªÉèÖúà http_proxy »·¾³±äÁ¿¾Í¿ÉÒÔÁË¡£
Äã¿ÉÒÔÔÚ windows ÃüÁîÐÐÖ´ÐУºset HTTP_PROXY=http://your.proxy.com:yourPort »òÔÚ linux ÏÂÖ´ÐУºexport HTTP_PROXY="http://your.proxy.com:yourPort"£¬È»ºóÔÙÖ´ÐÐ easy_install ¼´¿É¡£
socks5
ÓÉÓÚÄǵÀǽµÄ´æÔÚ£¬Ðí¶àÈËÊÇͨ¹ý VPS µÄ SSH ·Ç½µÄ£¬ÔÚ windows ϳ£ÓõÄÒ»¸öÈí¼þÊÇ myentunnel£¬ËüÄܹ»Ìṩ socks5 ´úÀí·þÎñ¡£¿Éϧ easy_install ûÓа취ֱ½ÓʹÓà socks5 ´úÀí£¬ËùÒÔÐèÒªÒ»¸öÈí¼þÀ´°Ñ socks5 ´úÀíת»»Îª http ´úÀí¡£Í¨¹ý twitter ÉÏÐí¶àÓѺÃÈËÊ¿µÄÌáµã£¬ÎÒÑ¡ÔñÁË polipo Õâ¸öÈí¼þÀ´´òÔì http ´úÀí¡£
polipo ʹÓ÷dz£¼òµ¥£¬ÔÚÕâÀhttp://interloper.org/tmp/polipo/polipo-1.0.4.1-forbidden-1-win32.exe£©ÏÂÔص½Ò»¸ö windows ϵݲװÎļþ£¬Ò»Â· next °²×°¼´¿É£¬°²×°ºó½øÈë polipo.exe ËùÔڵݲװĿ¼£¬ÓüÇʱ¾»òÆäËü±à¼Æ÷£¨ÎÒʹÓà gvim£©´ò¿ª config Îļþ£¬ÕÒµ½ÏÂÃæÁ½ÐУº
# socksParentProxy = “localhost:9050″
# socksProxyType = socks5
È»ºó°ÑÇ°ÃæµÄ # È¥µô£¬°Ñ 9050 ¸Ä³ÉÄãµÄ socks5 ·þÎñÆ÷µÄ¶Ë¿Ú£¬ÎÒʹÓõÄÊÇ myentunel ĬÈ쵀 1080£¬È»ºó±£´æ¹Ø±Õ¡£
ÏÖÔÚͨ¹ý¿ªÊ¼²Ëµ¥ÔËÐÐ polipo£¬ÄãÓ¦¸Ã¿ÉÒÔ¿´µ½ Established listening socket on port 8123 ×ÖÑù£¬±íʾÔËÐгɹ¦ÁË¡£ÕâʱÔÙͨ¹ýÉÏÎĵķ½·¨°Ñ http://127.0.0.1:8123 ÉèÖÃΪ http_proxy »·¾³±äÁ¿£¬ÄãµÄ easy_install ¾Í¿ÉÒԷǽÁË¡£
ÆäËü·½°¸
×ÔÓÉµÄ linux ϵ±È»ÓÐןü·á¸»µÄ·½Ê½£¬polipo ±¾ÉíÊǸö¿çƽ̨Èí¼þ£¬Ò²¿ÉÒÔʹÓà @number5¡¢@kynix ºÍ @kypudding ÍƼöµÄ tscoks ÒÔ¼° ProxyChains£¬windows ÏÂÒ²»¹¿ÉÒÔʹÓà SocksCap¡£¶øÎÒ²ÉÓÃµÄ polipo ·½°¸À´×Ô @BOYPT µÄÍƼö£¬¸ÐлËù
Ïà¹ØÎĵµ£º
Ö»ÐèÒªÔÚÎļþÖÐimportÓëÄãдµÄÎļþµÄÎļþÃûÒ»ÖµÄÄ£¿éÃû¼´¿É£¬Õâʱpython»áΪÄã´´½¨Ò»¸öpycÎļþµÄ¡£
¼´£¬Èç¹ûÄãÒѾдÁËÒ»¸öÃûΪssss.pyµÄÎļþ£¬¶øÏÖÔÚÄãÐèÒªÔÚÃûΪaaaa.pyµÄÎļþÖÐʹÓÃssss.pyÖж¨ÒåµÄ·½·¨£¬ÄÇôÄãÖ»ÐèÒªÔÚaaaa.pyÖмÓÈëimport ssss£¬È»ºóÄã¾Í¿ÉÒÔÔÚaaaa.pyÖÐʹÓÃssss.pyÖеķ½·¨£¨µ±È»·½·¨Ç°ÐèÒª¼ÓÄ£¿éÃû ......
Python Import»úÖƱ¸Íü(ת)
×î½üÔÚ¿´¡¶PythonÔ´ÂëÆÊÎö¡·£¬¶ÔPythonÄÚ²¿ÔËÐлúÖƱÈÒÔÇ°Á˽âµÄ¸üÉîÈëÁË£¬¸Ð¾õ×Ô¼ºÓлú»áÒ²¿ÉÒÔ×ö¸öСÐ͵Ķ¯Ì¬½Å±¾ÓïÑÔÁË£¬ºÇºÇ£¬µ±È»
ÊÇ´µÅ£ÁË¡£Ä¿µÄµ±È»²»ÊÇ´´ÔìÒ»¸ö¶¯Ì¬ÓïÑÔ£¬Ä¿µÄÖ»ÓÐÒ»¸ö£º¸üºÃµÄʹÓÃPython¡£¿´µ½Ä£¿éµ¼ÈëÄÇ¿éµÄʱºò£¬ÖÕÓÚ¶ÔÄ£¿éµ¼Èë»úÖƱȽÏÁ˽âÁË£¬ÒÔ·ÀÍ ......
ÏÂÔصÄPDFÎĵµÖÐÓеÄÃüÃûºÜÂÒ£¬¾ÍÏëÆðÁË×Ô¼ºÐ´¸ö³ÌÐò£¬È»ºó¶ÁÈ¡PDFµÄtitleÊôxing£¬¸ù¾ÝÕâ¸öÊôxing£¬¸ü¸Ä´ÎÎĵµµÄÃû×Ö£¡ÒÔÏÂÊÇ´úÂ룺
ÐèÒªµ½£ºhttp://pybrary.net/pyPdf/ÉÏÃæÏÂÔضÔӦƽ̨µÄPDFµÄ¿âÎļþ£¬È»ºó°²×°£¬µ¼Èë¡£
#encoding:utf-8
import os
import operator
from pyPdf import PdfFileWriter, PdfFileReader ......
ÆäʵÒì³£¾ÍÊDz»Õý³££¬¾ÍÊDz»ºÍÎÒÃÇÏëÏóÒ»ÑùÈ¥Ö´ÐС£ËüÊÇÒòΪ³ÌÐò³öÏÖÁË´íÎó¶øÔÚÕý³£¿ØÖÆÁ÷ÒÔÍâ²ÉÈ¡µÄÐÐΪ¡£Python³öÏÖÒì³££¬¾ÍÊÇÒòΪ¼ì²éÁËÒ»¸ö´íÎóʱ£¬Python½âÊÍÆ÷ÎÞ·¨¼ÌÐø¼ÌÐøÖ´ÐÐÏÂÈ¥£¬ÕâʱºòÅ׳öÁËÒì³£¡£ÍùÍùÕâ¸ö´íÎó·ÖΪÓï·¨ÉϺÍÂß¼ÉÏ(²»Éó¤Ëµ¸ÅÄ-_-! )£¬¿´¿´¼¸¸öÀý×Ó£¬×ܽáһϣº
1¡¢NameError£º³¢ÊÔ·ÃÎÊÒ»¸öÎ ......
def getText(self,nodelist):
rc=""
for node in nodelist:
if node.nodeType == node.TEXT_NODE or node.nodeType == node.CDATA_SECTION_NODE:
rc = rc + node.data
return rc
def parseXML(self,requesturl,xml):
dom = minidom.parse(requesturl)
for node in dom.getElementsByTagName('ca ......