確定目標(biāo)
分析目標(biāo):URL格式 數(shù)據(jù)格式 網(wǎng)頁編碼
編寫代碼
執(zhí)行爬蟲
分析目標(biāo):URL格式 數(shù)據(jù)格式 網(wǎng)頁編碼
編寫代碼
執(zhí)行爬蟲
2017-10-29
獲取p段落文字 然后指定其class 來獲取它的內(nèi)容
print'獲取p段落文字'
p_node=soup.find('p',class='title')
print p_node.name, p_name.get_text()
print'獲取p段落文字'
p_node=soup.find('p',class='title')
print p_node.name, p_name.get_text()
2017-10-29
bs支持正則表達(dá)式的匹配 模糊匹配#
print '正則匹配'
href=re.compile(r'ill')
r'..' 如果正則表達(dá)式中出現(xiàn)反斜線 只需要寫一個反斜線
print '正則匹配'
href=re.compile(r'ill')
r'..' 如果正則表達(dá)式中出現(xiàn)反斜線 只需要寫一個反斜線
2017-10-29
給出的這個調(diào)度時序圖很像講操作系統(tǒng)里面的multithreading的時候,file IO和read帶自身優(yōu)先級的CPU和Algorithm資源配置調(diào)度
2017-10-28
求問為何報(bào)錯,代碼:http://idcbgp.cn/qadetail/240912
Traceback (most recent call last):
spider_main.py", line 44, in <module>
obj_spider.craw(root_url)
new_urls,new_data = self.parser.parse(new_url,html_cont)
TypeError: 'NoneType' object is not iterable
Traceback (most recent call last):
spider_main.py", line 44, in <module>
obj_spider.craw(root_url)
new_urls,new_data = self.parser.parse(new_url,html_cont)
TypeError: 'NoneType' object is not iterable
2017-10-25
#py3 實(shí)例 查看百度首頁圖片
import urllib.request
from bs4 import BeautifulSoup
url = "http://www.baidu.com/"
request = urllib.request.Request(url)
response = urllib.request.urlopen(request)
data = response.read()
data = data.decode('utf-8')
soup = BeautifulSoup(data,'html.parser')
print(soup.find_all('img'))
import urllib.request
from bs4 import BeautifulSoup
url = "http://www.baidu.com/"
request = urllib.request.Request(url)
response = urllib.request.urlopen(request)
data = response.read()
data = data.decode('utf-8')
soup = BeautifulSoup(data,'html.parser')
print(soup.find_all('img'))
2017-10-22
python3.6代碼:https://github.com/Nana0606/PythonProject/tree/master/spider_me(將結(jié)果改成了輸出100條url的信息)
2017-10-21