Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/306.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
Python 我怎样才能把线头刮干净?_Python_Scrapy - Fatal编程技术网

Python 我怎样才能把线头刮干净?

Python 我怎样才能把线头刮干净?,python,scrapy,Python,Scrapy,我正试图收到完整的邮件,但只花了1分钟。我没有得到.com这是HTML <div class="email-show tr1" rel="hello@example.com" xpath="1"> <div class="left tr1"><i class="fa fa-at"></i></div>

我正试图收到完整的邮件,但只花了1分钟。我没有得到.com这是HTML

<div class="email-show tr1" rel="hello@example.com" xpath="1">
              <div class="left tr1"><i class="fa fa-at"></i></div>
              <div class="right tr1 noselect">
                <span>hello@example</span>.com              </div>
            </div>
输出

hallo@example
请告诉我我做错了什么。提前感谢:)

response.xpath('/*[@class=“email show tr1”]/@rel')。extract_first()

您只需使用

"".join(line for line in response.xpath('//*[contains(@class, "email-show")]//text()').extract())

您是否意识到
标记中没有
.com
.com
位位于
中。是的,但如何将它们添加到一起?
"".join(line for line in response.xpath('//*[contains(@class, "email-show")]//text()').extract())