这是我的代码:
from lxml.html import fromstring
#code
print fromstring(s).xpath('/html/body/div[3]/div/div[2]/div/form/input[4]')输出为[<InputElement 2946d20 name='question' type='hidden'>]
如何输出值?这个有什么属性吗?谢谢。
发布于 2014-03-18 03:36:36
发布于 2014-03-18 13:32:30
这可以通过XPath直接完成--不需要更改周围的Python。
print fromstring(s).xpath('/html/body/div[3]/div/div[2]/div/form/input[4]/text()')https://stackoverflow.com/questions/22469785
复制相似问题