<form method="post" name="login_form" action="/submit">我试图得到我尝试过的动作属性
print fromstring(source).xpath('.//form[@action]')[0].text,但它会打印
None
发布于 2014-06-05 16:25:08
XPath表达式返回<form>元素,而不是属性。
从元素中获取属性:
print fromstring(source).xpath('.//form[@action]')[0].get('action')https://stackoverflow.com/questions/24065340
复制相似问题