Parsing stray text with Scrapy
问题 Any idea how to extract 'TEXT TO GRAB' from this piece of markup: <span class="navigation_page"> <span> <a itemprop="url" href="http://www.example.com"> <span itemprop="title">LINK</span> </a> </span> <span class="navigation-pipe">></span> TEXT TO GRAB </span> 回答1: It's not an ideal solution but it should do the trick: from scrapy import Selector content=""" <span class="navigation_page"> <span> <a itemprop="url" href="http://www.example.com"> <span itemprop="title">LINK</span> </a> </span>