看板 Python 關於我們 聯絡資訊
我想一次抓取全家便利店全省的商店資訊, 觀察到是他以每個縣市命名為各自的.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') <--- 啊?! 可以指導一下嗎??? -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 118.160.83.246 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1500655195.A.A78.html
AndCycle: 你不熟的東西叫做 css selector 07/22 01:06
AlaRduTP: https://goo.gl/kPcLLq 07/22 08:59
AlaRduTP: 我會先找table 再找裡面的a 07/22 09:00
coeric: 裡面有json不是? 07/24 12:55