Scrapy .css select element with a specific attribute name and value
<p>How can Scrapy be used to select the text of an element that has a particular attribute name and value?</p>

<p>For example,</p>

<pre><code>&lt;span property="city"&gt;Montreal&lt;/span&gt;
</code></pre>

<p>I tried the following but received a <code>None</code></p>

<pre><code>response.css('.span[property="city"]::text').extract_first() 
</code></pre>

<p>You are making a small mistake. You need to drop the <code>'.'</code> before <code>'span'</code>:</p>

<pre><code>In [6]: response.css('span[property="city"]::text').extract_first() 
Out[6]: u'Montreal'
</code></pre>

python python-2.7 scrapy