×Ô¶¯ÏÂÔØ²¢±£´æ²©¿Í Python½Å±¾
лÁËÒ»¸ö×Ô¶¯ÏÂÔØÖ¸¶¨È˵IJ©¿ÍµÄ½Å±¾
Õâ¸ö½Å±¾ÊÇÓÃÀ´ÏÂÔØcsdn²©¿ÍµÄ
ͬÑùµÄ·½·¨¿ÉÒÔÏÂÔØÒ»°ãÆäËûÍøÕ¾µÄ²©¿Í£¬Èçsina
ÓÐÊ±Ò³Ãæ·ÃÎʻᱻ¾Ü¾ø£¬ÖØÐÂÔËÐм´¿É
ÕâÖÖ³ÌÐòÊÇÔÚ·ÖÎöÁËÖ¸¶¨ÍøÕ¾£¬ÎÒÔÚÕâ¶ùÊÇcsdn£¬Ö®ºó±àд³öµÄ
»áÇ£Éæµ½ÍøÒ³µÄ±àÂëÎÊÌ⣬ÓÐʱ³ÌÐòÔËÐлáÒò´ËÖÕÖ¹
ÎÒ×Ô¼ºµÄ²©¿ÍÒѾÏÂÔØÍüÁË
Ö»ÊÇÏÂÔØÍøÒ³
ʹÓÃÍøÒ³·ÖÎöºó¿ÉÒÔÕûÀí³öÎÄÕ£¬ÄÇÑù¸üʵÓÃ
#
#blogdownloader_csdn.py
# @Author:onezeros@yahoo.cn ||Zhijie Lee
# I didnot realize the image_download function
# but it's not very difficult,so that you can do it by yourself
#cmd usage:blogdownloader_csdn.py blogname "full directory path"
#further extension :classify the articles to
# "Ô´´""×ªÔØ" etc.according to csdn
import os
import sys
import unicodedata
import urllib.request
#globle var
username=sys.argv[1]
#username='onezeros'
#total number of pages
total_num=0
dst_urls=[]
#use data as the file name
dst_title=[]
###########################################
#function to find urls of articals
#it's neccessory to verify whether the url exits
def url_finder(url_directory,firstpage=False):
global username,total_num,dst_urls,dst_title
url_f=urllib.request.urlopen(url_directory)
print("open url "+url_directory+" successfully\n")
url_front='/'+username+'/archive/'
for line in url_f.readlines():
lin=line.decode('utf-8')
pos_front=lin.find(url_front)
if(pos_front!=-1 ):
pos_post=len('2009/12/13/4998191.aspx')+len(url_front)+pos_front
if(lin[pos_post]=='#'):
dst_urls.append('http://blog.csdn.net'+lin[pos_front:pos_post])
s=lin[pos_front+len(url_front):pos_post-len('.aspx')]
s=s.replace('/','-')
print(s)
dst_title.append(s)
if(firstpage==True):
pos=lin.find('µÚ1Ò³')
if(pos!=-1):
pt=lin.find('Ò³',pos+5)
total_num=int(lin[pos+5:pt])
if(firstpage==True and total_num==0):
prin
Ïà¹ØÎĵµ£º
ÀµÓºƣ¨http://laiyonghao.com£©
½ñÌ죨2009Äê5ÔÂ31ÈÕ£© OurPNP.org ¸ãÁ˸ö¾Û»á»î¶¯£¬ÅªÁËÊ®¼¸¶þÊ®¸öÈËÔÚ¹ãÖݺ£Öé¹ã³¡µÄÌûá´ôÁËÎå¸öСʱ£¬´´ÏÂÁËÎÒÔÚ K ·¿´ôµÄ×ʱ¼ä¼Í¼¡£Ó¦ËûÃǵÄÑûÇ룬ÎÒ×öÁ˸öÌâΪ¡¶Óà python ¿ìËÙ´î½¨ÍøÓηþÎñÆ÷¡·µÄСÑݽ²£¬ÒòΪÄDZߵĵçÊÓ¾¹È»²»ÄܽӵçÄÔ£¬ËùÒÔ½²µÄʱºòûÓÐÄܹ»²ÎÕÕ PPT À´½²£¬¹Û ......
Posted on 18:40:00 by ÏþÔÂ and filed under Notepad++, Python
¡¡¡¡Notepad++ ÊÇÒ»¸ö¿ªÔ´µÄÎı¾±à¼Æ÷£¬¹¦ÄÜÇ¿´ó¶øÇÒʹÓ÷½±ã¡£±à¼ºÍµ÷ÊÔ Python ³ÌÐòʹÓÃʲô±à¼Æ÷»òÕß IDE ²»Í¬ÈËÓв»Í¬¼û½â¡£ÔÚ²»¿¼ÂÇʹÓõ÷ÊÔ¹¤¾ßµÄÇé¿öÏ£¬Vim »òÕß Emacs Óû§×ÔÈ»¿ÉÒÔÎÞÊÓÆäËû±à¼Æ÷£¬²»¹ýÔÚ Windows »·¾³Ï£¬Ê¹Óà Notepad++ Ö ......
def Start(self):
if (self.conn == None) or (self.conn.State == 1):
self.conn = win32com.client.Dispatch(r'ADODB.Connection')
&n ......
ÕæÊǵ¹Ã¹£¬¸ÕÂò²»¾ÃµÄÒÆ¶¯Ó²ÅÌ£¬×òÌìɾ³ýÒ»¸ö·ÖÇøÊ§°Üºó£¬¼¸¸ö·ÖÇø¶¼²»¼ûÁË£¬ÄÃÈ¥ÐÞ£¬Î´¹û
»»Á˸öÐµģ¬µ«ÆäÖÐÊý¾ÝȫûÁË¡£ÄÇÊÇÎÒÆ½Ê±ÊÕ¼¯µÄºÜÓÐÓõÄ×ÊÁÏ
ºÜ¶à¶¼¿ÉÒÔÖØÐÂÏÂÔØ£¬µ«ÔõÄÜÏëÆðÓ²ÅÌÖеÄËùÓж«Î÷
½ñÌì»»Ó²ÅÌ»ØÀ´
¾ÍÏñдһ¸ö±£´æÖ¸¶¨Â·¾¶ÏÂËùÓÐÎļþ¼ÐºÍÎļþÃûµÄ³ÌÐò
ÕâÑù£¬Èç¹û¶«Î÷¶ªÁË£¬¿´¿´ÄÇÀïÓÐЩʲô£¬Ò² ......
ÕâÊÇÒ»¸öÎÒÃÇÔÚ´¦ÀíÖÐÎÄʱ, ¾³£Óöµ½µÄÎÊÌâ.
pythonÀïÃæ»ù±¾ÉÏÒª¿¼ÂÇÈýÖÖ±àÂë¸ñʽ
1 Ô´Îļþ±àÂë
ÔÚÎļþÍ·²¿Ê¹ÓÃcodingÉùÃ÷¡£¸æËßpython½âÊÍÆ÷¸Ã´úÂëÎļþËùʹÓõÄ×Ö·û¼¯¡£
#/usr/bin/python
#coding: utf8
2 ÄÚ²¿±àÂë
´úÂëÎļþÖеÄ×Ö·û´®£¬¾¹ýdecodeÒԺ󣬱»×ª»»ÎªÍ³Ò»µÄunicode¸ñʽµÄÄÚ²¿Êý¾Ý£¬ÀàËÆÓÚu'*'¡£unic ......