摘要: 原创博文,转载请注明出处。单线程爬取:所用模块urllib2,re 1 # -*- coding: cp936 -*- 2 import urllib2 3 import re 4 5 def main(): 6 url="http://www.baidu.com/" 7 req = urllib2.Request(url) 8 resp = urllib2.urlopen(req) 9 respHtml = resp.read()10 #使用百度前必读 ,匹配内容11 ahn='(?P.+)'12 found=re.search(ahn,re... 阅读全文
posted @ 2014-01-03 09:30 枫桦宁 阅读(821) 评论(0) 推荐(0) 编辑