import requests from lxml import etree url = 'http://www.gdggzy.org.cn/prip-portal-web/main/Index.do?typeId=200122&city=&businessType=200120' r = requests.get(url=url).text r1 = etree.HTML(r) max_counts = r1.xpath('//div[@id="TestView_queryResult"]//div[@class="m-pagination-info"]/text()') print max_counts
想取最大数目,取不到,是空的,然后 xoath 里的检查了好几遍感觉没错呀