Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Url 解密此XPath表达式以获取完整的href属性_Url_Xpath_Scrapy_Absolute - Fatal编程技术网

Url 解密此XPath表达式以获取完整的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

有没有办法获得完整的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">
        <strong>hey Greg here is my HRM522 discussion</strong></a>
    <small>&quot;Auditing of Organizational Ethics and Compliance Programs&quot;  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()