我正在尝试解析div
HTML 文档中的一个大标签,并且需要获取其所有 HTML 和嵌套标签div
。我的代码:
innerTree = fromstring(str(response.text))
print("The tags inside the target div are")
print innerTree.cssselect('div.story-body__inner')
Run Code Online (Sandbox Code Playgroud)
但它打印:
[<Element div at 0x66daed0>]
Run Code Online (Sandbox Code Playgroud)
我想让它返回里面所有的HTML标签?如何使用 LXML 做到这一点?