Get the inner HTML of a element in lxml

后端 未结 6 2266
粉色の甜心
粉色の甜心 2020-12-13 19:10

I am trying to get the HTML content of child node with lxml and xpath in Python. As shown in code below, I want to find the html content of the each of product nodes. Does i

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 19:23

    another way to do this

    x=doc.xpath("//div[@class='name']/parent::*")
    print(map(etree.tostring,x))
    

提交回复
热议问题