title: Can i use while loop with 'i' as a variable which will be used in tr[i] in xpath?
body: <pre><code>import scrapy
  import logging
  
  class AssetSpider(scrapy.Spider):
      name = 'asset'
      start_urls = ['http://mnregaweb4.nic.in/netnrega/asset_report_dtl.aspx?lflag=eng&amp;state_name=WEST%20BENGAL&amp;state_code=32&amp;district_name=NADIA&amp;district_code=3201&amp;block_name=KRISHNAGAR-I&amp;block_code=&amp;panchayat_name=DOGACHI&amp;panchayat_code=3201009009&amp;fin_year=2020-2021&amp;source=national&amp;Digest=8+kWKUdwzDQA1IJ5qhD8Fw']
  def parse(self, response):
      i = 4
      while i&lt;2236:
          assetid = response.xpath(&quot;//table[2]//tr['i']/td[2]/text()&quot;)
          assetcategory = response.xpath(&quot;//table[2]//tr['i']/td[3]/text()&quot;)
          schemecode = response.xpath(&quot;//table[2]//tr['i']/td[5]/text()&quot;)
          link = response.xpath(&quot;//table[2]//tr['i']/td[6]/a/@href&quot;)
          schemename = response.xpath(&quot;//table[2]//tr['i']/td[7]/text()&quot;)
          yield {
              'assetid' : assetid,
              'assetcategory' : assetcategory,
              'schemecode' : schemecode,
              'link' : link,
              'schemename' : schemename
          }
          i += 1
  </code></pre>
  <p>I want to use 'i' variable to loop in the xpath of tr[position] from 4 to 2235. i just dont know if it is possible! and if it is possible, then what is the right way to do it? mine does not work.</p>