0
你好我想放棄從網頁數據,如Python的Scrapy讓所有的孩子,但忽略<br>
<div id="print">
.
.
<div id="item">
<div class="span3 col-3">
Processor: 6th Gen. Intel Core i5 6200U
<br>
Clock speed: 2.30-2.80GHz
<br>
</div>
</div>
<div id="item">
.
.
</div>
</div>
當我使用
for res in response.css('div#print'):
text = res.css("div#item div.col-3::text").extract()
輸出:
u'Processor:\xa07th Gen. Intel Core i5 7200U ', u'Clock speed:\xa02.50-3.10GHz '
我得到2個元素。我如何使用<br>
標籤記錄整個文本。謝謝。
你想要得到的輸出與
標籤?或換行符(\ n)就足夠了? – Prabhakar
這對我來說足夠了。我很驚訝爲什麼我沒有得到全文。爲什麼它分爲兩個項目? –