python 简单爬虫diy

简单爬虫直接diy, 复杂的用scrapy

import urllib2
import re
from bs4 import BeautifulSoap

req = urllib2.Request(url, headers={'User-Agent' : "Magic Browser"})

webpage= urllib2.urlopen(req)

soap = BeautifulSoap(webpage.read())
...

 

posted on 2016-10-27 09:38  星空守望者--jkmiao  阅读(164)  评论(0编辑  收藏  举报