[问题] 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