Best library to parse HTML with Python 3 and example?

前端 未结 6 1567
轮回少年
轮回少年 2020-12-24 12:50

I\'m new to Python completely and am using Python 3.1 on Windows (pywin). I need to parse some HTML, to essentially extra values between specific HTML tags and am confused a

6条回答
  •  自闭症患者
    2020-12-24 13:32

    I'm currently using lxml, and on Windows I used the installation binary from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml.

    import lxml.html
    page = lxml.html.fromstring(...)
    title = page.xpath('//head/title/text()')[0]
    

提交回复
热议问题