作者qwertmn (抽筋)
看板Python
标题[问题] 爬虫问题..
时间Mon Nov 12 10:12:39 2012
我想抓台南县观光旅游局的资料..网址如下
http://tour.tainan.gov.tw/action.aspx?season=spring
不过我用lxml 分析tag 的结构都不对.. 程式码如下
from lxml import html
import urllib2
file = urllib2.urlopen('
http://tour.tainan.gov.tw/action.aspx?season=spring')
root = html.parse(file).getroot()
#这边都抓不到table... 不过我用chrome 去抓过document tree, 有抓到超过100个...
print root.cssselect('table')
不知道我哪边有做错了..
求救..
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 59.120.142.214
1F:推 CMJ0121:file.read() ?? 11/12 11:09
2F:推 swpoker:有先写到档案看看吗~常见就是编码或是HTML的DOM有问题 11/12 13:08
3F:→ qwertmn:有试过wget下来ˇˇ.. 不过一样.. 11/12 20:27
4F:→ qwertmn:html 的dom应该没有问题>"< 11/12 20:28
5F:→ qwertmn:抓的到body & html.. 不过资料缺一大块.. 11/12 20:29