V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
U87
V2EX  ›  问与答

实在没找到错在哪里,爬虫方面

  •  
  •   U87 · Apr 18, 2018 · 1510 views
    This topic created in 2936 days ago, the information mentioned may be changed or developed.

    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 里的检查了好几遍感觉没错呀

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   785 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 22:16 · PVG 06:16 · LAX 15:16 · JFK 18:16
    ♥ Do have faith in what you're doing.