PTT
Submit
Submit
選擇語言
正體中文
简体中文
PTT
Python
Re: [問題] python網路爬蟲,怎麼抓取表格內容
作者:
okeyla
(小寶)
2017-07-22 10:32:46
※ 引述《okeyla (小寶)》之銘言:
: 我想一次抓取全家便利店全省的商店資訊,
: 觀察到是他以每個縣市命名為各自的.php, 然後各縣市商店都在對應的php裡面.
: idea是先抓取各縣市的php名稱放入list,
: 再以此list帶出各縣市的網頁, 再取出商店資訊.
: 目前卡在這兒, 找不著標籤...
: import requests
: from bs4 import BeautifulSoup
: res = requests.get('http://www.allergen.com.tw/famistore.php')
: res.encoding = 'utf-8'
: #print res.text
: soup = BeautifulSoup(res.text)
: # 跑個loop挑出famiKeelung.php, famiTaipei.php... etc.
: print soup.select('.td') <
作者:
LessonWang
(橘白Cat)
2017-07-22 11:00:00
css selector 不是只有class和id選擇器而已啊xd話說原po怎不想使用lxml的etree以及HTMLParser搭配瀏覽器的xpath checker很快就抓的到資料啦xd
http://i.imgur.com/9K0wnq3.jpg
這些href屬性值應該是你要的部分吧
http://i.imgur.com/n3Ef8Lu.jpg
作者: AlaRduTP (Eden)
2017-07-22 11:32:00
http://i.imgur.com/12Cwg4L.png
繼續閱讀
[問題] python網路爬蟲,怎麼抓取表格內容
okeyla
[問題] 請問編輯器對物件的提示功能
LeonH
[問題] list的維度怎麼算
LessonWang
[問題] 爬蟲 多家公司股市新聞
henrycc
Re: [問題] GUID 字串格式轉換
uranusjr
Re: [問題] GUID 字串格式轉換
LessonWang
[問題] GUID 字串格式轉換
LwHow
[閒聊] python 對硬碟操作
j5128709
[問題] list比對
LaughPoint
Re: [問題] 關於list的append方法
zerof
Links
booklink
Contact Us: admin [ a t ] ucptt.com