title: Scrapy/Python: Replace empty string
body: <p>So here is my Scrapy crawler code. I am trying to extract meta data values from a website. No metadata appears more than once on a page.</p>
  
  <pre><code>class MySpider(BaseSpider):
      name = "courses"
      start_urls = ['http://www.example.com/listing']
      allowed_domains = ["example.com"]
      def parse(self, response):
       hxs = Selector(response)
      #for courses in response.xpath(response.body):
       for courses in response.xpath("//meta"):
       yield {
                  'ScoreA': courses.xpath('//meta[@name="atarbur"]/@content').extract_first(),
                  'ScoreB': courses.xpath('//meta[@name="atywater"]/@content').extract_first(),
                  'ScoreC': courses.xpath('//meta[@name="atarsater"]/@content').extract_first(),
                  'ScoreD': courses.xpath('//meta[@name="clearlywaur"]/@content').extract_first(),
                 }
       for url in hxs.xpath('//ul[@class="scrapy"]/li/a/@href').extract():
        yield Request(response.urljoin(url), callback=self.parse)
  </code></pre>
  
  <p>So what I am trying to achieve is that if the values of any of the Scores is an empty string (''), I want to repalce it with 0 (zero). I am not sure how to add conditional logic inside the 'yield' block.</p>
  
  <p>Any help is very appreciated.</p>
  
  <p>Thanks</p>