Xpath以python返回整个文档

问题描述 投票:0回答:1

我正在尝试调试一些继承的代码。所以有一行代码elt = doc.xpath('body/div/pre[@id="bb flags"]')[0]

我想查看整个文档的外观,而不只是一个特定的片段。那我应该在那插入什么xpath?即

elt_entire_document = doc.xpath(new xpath)
logging.info("The full document here is " + elt_entire_document.text)

xpath甚至可能做到这一点,还是比它更复杂?

python xpath
1个回答
0
投票

根据我们的评论,就这样简单:

logging.info("The full document here is " + text)
© www.soinside.com 2019 - 2024. All rights reserved.