[問題] python網路爬蟲,怎麼抓取表格內容

作者: okeyla (小寶)   2017-07-22 00:39:52
我想一次抓取全家便利店全省的商店資訊,
觀察到是他以每個縣市命名為各自的.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') <
作者: AndCycle (AndCycle)   2017-07-22 01:06:00
你不熟的東西叫做 css selector
作者: AlaRduTP (Eden)   2017-07-22 08:59:00
https://goo.gl/kPcLLq我會先找table 再找裡面的a
作者: coeric ( )   2017-07-24 12:55:00
裡面有json不是?

Links booklink

Contact Us: admin [ a t ] ucptt.com