python脚本问题
下面那段代码,运行后每次只能取得23或7条记录,但实际有80条,我用Firepath在网页上抓也是80条。
放在循环里面输出,就只有23条或7条了,而且还一会23,一会7。。。
求大神指点~
================================================================
import urllib.request
from lxml import etree
response = urllib.request.urlopen('http://sh.ganji.com/fang1/changning/') #使用urlopen打开网址
html = response.read() #读取目标网页内容
selector = etree.HTML(html)
title = selector.xpath('//*[@class="f-list-item ershoufang-list"]/dl/dd[1]/a/text()')
money = selector.xpath('//*[@class="f-list-item ershoufang-list"]/dl/dd[5]/div[1]/span[1]/text()')
for i,j in zip(title,money):
print(i,":",j)
================================================================