Xpath 多级解析

selector = Selector(response)
divs = selector.xpath(‘//div[@class=”detials-title-cont”]’)
for div in divs:
h4divs = div.xpath(“./h4/text()”)
for h4div in h4divs:
print “——- “,h4div.extract()
uldivs = div.xpath(‘./following-sibling::ul[1]’)
for uldiv in uldivs:
uladivs = uldiv.xpath(“./li/div/div/a/text()”)
for uladiv in uladivs:
print “parse_tpo_lecture_select txt ——————” ,uladiv.extract()

Next ArticleRocket chat 项目结构