Url 解密此XPath表达式以获取完整的href属性
有没有办法获得完整的href属性()而不是部分href?()从这个标记中删除Url 解密此XPath表达式以获取完整的href属性,url,xpath,scrapy,absolute,Url,Xpath,Scrapy,Absolute,有没有办法获得完整的href属性()而不是部分href?()从这个标记中删除 <td class="word-break"> <span class="label label-success">Due in 5 days</span> <a href="https://studyacer.com/question/hey-greg-here-is-my-hrm522-discussion-444593"> <s
<td class="word-break">
<span class="label label-success">Due in 5 days</span>
<a href="https://studyacer.com/question/hey-greg-here-is-my-hrm522-discussion-444593">
<strong>hey Greg here is my HRM522 discussion</strong></a>
<small>"Auditing of Organizational Ethics and Compliance Programs" Please respond to the following:...
</small>
<br />
<strong>Business > Management</strong>
</td>
我得到了部分url。适用于任何有类似问题的人。结果是跑步
response.xpath('xpath_expression')
在Scrapy中为您提供部分url。特别是如果url很长。
对于完整值,请在末尾使用extract()。像这样
response.xpath('xpath_expression').extract()
欢迎使用SO:-)该值必须被您使用的某些工具截断,xpath中没有任何东西会主要截断它,因此您这边也没有任何东西可以更改它。您可以(通过单击“编辑”)将有关您的工具的信息添加到问题中,并在什么位置找到截断值…@stefanHegny感谢您的欢迎!我用Scrapy实现了一个基本的爬虫程序。你是对的,是刮削工具截断了全部值。
response.xpath('xpath_expression').extract()