title: Scrapy: retain original order of scraped items in the output
body: <p>I have the following Scrapy spider to get the status of the pages from the list of urls in the file url.txt</p>
  
  <pre><code>import scrapy
  from scrapy.contrib.spiders import CrawlSpider
  from pegasLinks.items import StatusLinkItem
  
  class FindErrorsSpider(CrawlSpider):
      handle_httpstatus_list = [404,400,401,500]
      name = "findErrors"
  
      allowed_domains = ["domain-name.com"]
      f = open("urls.txt")
      start_urls = [url.strip() for url in f.readlines()]
      f.close()
  
      def parse(self, response):
          item = StatusLinkItem()
          item['url'] = response.url
          item['status'] = response.status
          yield item
  </code></pre>
  
  <p>Here's my items.py file:</p>
  
  <pre><code>import scrapy
  
  class StatusLinkItem(scrapy.Item):
      url = scrapy.Field()
      status = scrapy.Field()
  </code></pre>
  
  <p>I use the following command to get the output of items in CSV:</p>
  
  <pre><code>scrapy crawl findErrors -o File.csv
  </code></pre>
  
  <p>The order of items in the ouput file is different from the order of corresponding urls in urls.txt file. How can I retain the original order or add another field to the items.py with some kind of global variable, which will represent the id of the urls, with which I will be able to restore the original order later?</p>